Support the load initialPosition/initialIndex parameters on web.
This commit is contained in:
parent
f38ff383f5
commit
082666d9d1
|
@ -114,6 +114,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.16.1"
|
version: "0.16.1"
|
||||||
|
js:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: js
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.6.3-nullsafety.1"
|
||||||
just_audio:
|
just_audio:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -127,7 +134,7 @@ packages:
|
||||||
path: "../../just_audio_platform_interface"
|
path: "../../just_audio_platform_interface"
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "1.1.0"
|
version: "1.2.0"
|
||||||
just_audio_web:
|
just_audio_web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -148,7 +155,7 @@ packages:
|
||||||
name: meta
|
name: meta
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0-nullsafety.3"
|
version: "1.3.0-nullsafety.4"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -237,7 +244,7 @@ packages:
|
||||||
name: stack_trace
|
name: stack_trace
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.0-nullsafety.1"
|
version: "1.10.0-nullsafety.2"
|
||||||
stream_channel:
|
stream_channel:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -302,5 +309,5 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.2"
|
version: "0.1.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.10.0-110 <2.11.0"
|
dart: ">=2.10.0-110 <=2.11.0-213.1.beta"
|
||||||
flutter: ">=1.12.13+hotfix.5 <2.0.0"
|
flutter: ">=1.12.13+hotfix.5 <2.0.0"
|
||||||
|
|
|
@ -182,11 +182,19 @@ class Html5AudioPlayer extends JustAudioPlayer {
|
||||||
print("web load");
|
print("web load");
|
||||||
_currentAudioSourcePlayer?.pause();
|
_currentAudioSourcePlayer?.pause();
|
||||||
_audioSourcePlayer = getAudioSource(request.audioSourceMessage);
|
_audioSourcePlayer = getAudioSource(request.audioSourceMessage);
|
||||||
_index = 0;
|
_index = request.initialIndex ?? 0;
|
||||||
if (_shuffleModeEnabled) {
|
if (_shuffleModeEnabled) {
|
||||||
_audioSourcePlayer?.shuffle(0, _index);
|
_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 {
|
Future<Duration> loadUri(final Uri uri) async {
|
||||||
|
|
|
@ -25,20 +25,27 @@ packages:
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
js:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: js
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.6.3-nullsafety.1"
|
||||||
just_audio_platform_interface:
|
just_audio_platform_interface:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: just_audio_platform_interface
|
path: "../just_audio_platform_interface"
|
||||||
url: "https://pub.dartlang.org"
|
relative: true
|
||||||
source: hosted
|
source: path
|
||||||
version: "1.1.0"
|
version: "1.2.0"
|
||||||
meta:
|
meta:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0-nullsafety.3"
|
version: "1.3.0-nullsafety.4"
|
||||||
plugin_platform_interface:
|
plugin_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -66,5 +73,5 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0-nullsafety.3"
|
version: "2.1.0-nullsafety.3"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.10.0-110 <2.11.0"
|
dart: ">=2.10.0-110 <=2.11.0-213.1.beta"
|
||||||
flutter: ">=1.12.13+hotfix.5"
|
flutter: ">=1.12.13+hotfix.5"
|
||||||
|
|
Loading…
Reference in New Issue