Fix bug setting second audio source while playing.
This commit is contained in:
parent
8d645bb75f
commit
62c369527f
|
@ -120,7 +120,7 @@ packages:
|
||||||
path: ".."
|
path: ".."
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "0.6.0"
|
version: "0.6.1"
|
||||||
just_audio_platform_interface:
|
just_audio_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -545,7 +545,7 @@ class AudioPlayer {
|
||||||
_playbackEventSubject.add(_playbackEvent = PlaybackEvent(
|
_playbackEventSubject.add(_playbackEvent = PlaybackEvent(
|
||||||
currentIndex: initialIndex, updatePosition: initialPosition));
|
currentIndex: initialIndex, updatePosition: initialPosition));
|
||||||
_broadcastSequence();
|
_broadcastSequence();
|
||||||
// If the active platform existed, we should try to retain it.
|
// TODO: If the active platform existed, we should try to retain it.
|
||||||
try {
|
try {
|
||||||
await _setPlatformActive(false);
|
await _setPlatformActive(false);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -679,7 +679,7 @@ class AudioPlayer {
|
||||||
Future<void> play() async {
|
Future<void> play() async {
|
||||||
if (_disposed) return;
|
if (_disposed) return;
|
||||||
if (playing) return;
|
if (playing) return;
|
||||||
_setPlatformActive(true);
|
_setPlatformActive(_audioSource != null);
|
||||||
_playInterrupted = false;
|
_playInterrupted = false;
|
||||||
final audioSession = await AudioSession.instance;
|
final audioSession = await AudioSession.instance;
|
||||||
if (await audioSession.setActive(true)) {
|
if (await audioSession.setActive(true)) {
|
||||||
|
@ -934,6 +934,7 @@ class AudioPlayer {
|
||||||
if (active) {
|
if (active) {
|
||||||
final automaticallyWaitsToMinimizeStalling =
|
final automaticallyWaitsToMinimizeStalling =
|
||||||
this.automaticallyWaitsToMinimizeStalling;
|
this.automaticallyWaitsToMinimizeStalling;
|
||||||
|
final playing = this.playing;
|
||||||
// To avoid a glitch in ExoPlayer, ensure that any requested audio
|
// To avoid a glitch in ExoPlayer, ensure that any requested audio
|
||||||
// attributes are set before loading the audio source.
|
// attributes are set before loading the audio source.
|
||||||
final audioSession = await AudioSession.instance;
|
final audioSession = await AudioSession.instance;
|
||||||
|
@ -959,6 +960,9 @@ class AudioPlayer {
|
||||||
shuffleMode: shuffleModeEnabled
|
shuffleMode: shuffleModeEnabled
|
||||||
? ShuffleModeMessage.all
|
? ShuffleModeMessage.all
|
||||||
: ShuffleModeMessage.none));
|
: ShuffleModeMessage.none));
|
||||||
|
if (playing) {
|
||||||
|
platform.play(PlayRequest());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (audioSource != null) {
|
if (audioSource != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -1997,8 +2001,8 @@ class _IdleAudioPlayer extends AudioPlayerPlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<PlayResponse> play(PlayRequest request) {
|
Future<PlayResponse> play(PlayRequest request) async {
|
||||||
throw UnimplementedError("play() has not been implemented.");
|
return PlayResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
Loading…
Reference in New Issue