Stay in loading state until load() completes on Android.

This commit is contained in:
Ryan Heise 2020-10-15 23:42:54 +11:00
parent 169715c720
commit 1ac687cedc
1 changed files with 4 additions and 1 deletions

View File

@ -217,7 +217,7 @@ public class AudioPlayer implements MethodCallHandler, Player.EventListener, Aud
} }
break; break;
case Player.STATE_BUFFERING: case Player.STATE_BUFFERING:
if (processingState != ProcessingState.buffering) { if (processingState != ProcessingState.buffering && processingState != ProcessingState.loading) {
transition(ProcessingState.buffering); transition(ProcessingState.buffering);
startWatchingBuffer(); startWatchingBuffer();
} }
@ -673,6 +673,9 @@ public class AudioPlayer implements MethodCallHandler, Player.EventListener, Aud
} }
public void dispose() { public void dispose() {
if (processingState == ProcessingState.loading) {
abortExistingConnection();
}
mediaSources.clear(); mediaSources.clear();
mediaSource = null; mediaSource = null;
loopingChildren.clear(); loopingChildren.clear();