Ensure native platform is disposed.
This commit is contained in:
parent
2aa9342442
commit
86a880a08a
|
@ -918,7 +918,8 @@ class AudioPlayer {
|
||||||
final currentIndex = this.currentIndex;
|
final currentIndex = this.currentIndex;
|
||||||
final audioSource = _audioSource;
|
final audioSource = _audioSource;
|
||||||
final newPlatform = active
|
final newPlatform = active
|
||||||
? JustAudioPlatform.instance.init(InitRequest(id: _id))
|
? (_nativePlatform =
|
||||||
|
JustAudioPlatform.instance.init(InitRequest(id: _id)))
|
||||||
: Future.value(_idlePlatform);
|
: Future.value(_idlePlatform);
|
||||||
_playbackEventSubscription?.cancel();
|
_playbackEventSubscription?.cancel();
|
||||||
final durationCompleter = Completer<Duration>();
|
final durationCompleter = Completer<Duration>();
|
||||||
|
@ -1031,6 +1032,7 @@ class AudioPlayer {
|
||||||
if (platform is _IdleAudioPlayer) {
|
if (platform is _IdleAudioPlayer) {
|
||||||
await platform.dispose(DisposeRequest());
|
await platform.dispose(DisposeRequest());
|
||||||
} else {
|
} else {
|
||||||
|
_nativePlatform = null;
|
||||||
try {
|
try {
|
||||||
await JustAudioPlatform.instance
|
await JustAudioPlatform.instance
|
||||||
.disposePlayer(DisposePlayerRequest(id: _id));
|
.disposePlayer(DisposePlayerRequest(id: _id));
|
||||||
|
|
Loading…
Reference in New Issue