Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[windows] onDurationChanged return -256204778:48:05.477000 in play local file #1384

Closed
j787701730 opened this issue Jan 15, 2023 · 5 comments · Fixed by #1469
Closed

[windows] onDurationChanged return -256204778:48:05.477000 in play local file #1384

j787701730 opened this issue Jan 15, 2023 · 5 comments · Fixed by #1469
Labels
bug platform-windows Affects the windows platform

Comments

@j787701730
Copy link

image

 Flutter (Channel stable, 3.3.10, on Microsoft Windows [版本 10.0.19045.2486], locale zh-CN)
    • Flutter version 3.3.10 on channel stable at D:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 135454af32 (4 weeks ago), 2022-12-15 07:36:55 -0800
    • Engine revision 3316dd8728
    • Dart version 2.18.6
    • DevTools version 2.15.0
@j787701730 j787701730 added the bug label Jan 15, 2023
@Gustl22
Copy link
Collaborator

Gustl22 commented Jan 15, 2023

Which AudioPlayers version do you use?
Can you provide the audio sample?

@Gustl22 Gustl22 added the platform-windows Affects the windows platform label Jan 15, 2023
@j787701730
Copy link
Author

audioplayers: ^2.0.0

final player = AudioPlayer(playerId: 'my_unique_playerId');

await player.play(DeviceFileSource('E:\Music\分飞.m4a'));

player.onDurationChanged.listen((Duration d) {
  print('d');
  print(d);
  duration.value = d.inSeconds < 0 ? const Duration(seconds: 0) : d;
});

@Gustl22
Copy link
Collaborator

Gustl22 commented Jan 21, 2023

Sorry I meant the audio file, not the source code... ;D Best regards
(if not able to upload, wrap is as a .zip file)

@j787701730
Copy link
Author

Sorry.
分飞.zip
The same is true for other MP3 files, audioplayers will return the result twice, and the second time is correct.

@bluefireteam bluefireteam deleted a comment from BraveEvidence Mar 15, 2023
@Gustl22
Copy link
Collaborator

Gustl22 commented Apr 9, 2023

Ok this is due to the play statement, which doesn't wait until the player has buffered enough audio to determine the duration. See #361

Gustl22 added a commit that referenced this issue Apr 11, 2023
Gustl22 added a commit that referenced this issue Apr 17, 2023
Gustl22 added a commit that referenced this issue May 8, 2023
…g the source (#1469)

# Description

Add a callback when the player has prepared its source, which is tangled
to the asynchronous `setSource` method, to improve experience, when
player should actually play and not wait for the player to prepare /
load the source. 

## Related Issues

Closes #1118 
Closes #1384 
Closes #1359

#1191
flutter/flutter#126209
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug platform-windows Affects the windows platform
Projects
None yet
2 participants