Support the load initialPosition/initialIndex parameters on web.
This commit is contained in:
parent
f38ff383f5
commit
082666d9d1
3 changed files with 34 additions and 12 deletions
|
@ -182,11 +182,19 @@ class Html5AudioPlayer extends JustAudioPlayer {
|
|||
print("web load");
|
||||
_currentAudioSourcePlayer?.pause();
|
||||
_audioSourcePlayer = getAudioSource(request.audioSourceMessage);
|
||||
_index = 0;
|
||||
_index = request.initialIndex ?? 0;
|
||||
if (_shuffleModeEnabled) {
|
||||
_audioSourcePlayer?.shuffle(0, _index);
|
||||
}
|
||||
return LoadResponse(duration: await _currentAudioSourcePlayer.load());
|
||||
final duration = await _currentAudioSourcePlayer.load();
|
||||
if (request.initialPosition != null) {
|
||||
await _currentAudioSourcePlayer
|
||||
.seek(request.initialPosition.inMilliseconds);
|
||||
}
|
||||
if (_playing) {
|
||||
_currentAudioSourcePlayer.play();
|
||||
}
|
||||
return LoadResponse(duration: duration);
|
||||
}
|
||||
|
||||
Future<Duration> loadUri(final Uri uri) async {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue