You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
E/MediaPlayerNative: start called in state 4, mPlayer(0xb400007c64c690b0)
E/MediaPlayerNative: error (-38, 0)
Information
I searched for this error code, and it appears that the problem is that player.start() is called before the onPrepared callback is fired.
After digging into the implementation (AudioPlayer.java), I found that both the startPlaying and seekToPlaying call readyPlayer() and only do stuff immediately if readyPlayer() returns true, otherwise will set some values to do it in the callback once the player is ready.
readyPlayer() creates the player if it doesn't exist yet, and it looks like it is meant to return false if the player is not ready; however it seems to return true in the MEDIA_STARTING as well.
I'm wondering if there is any reason for it to return true while MEDIA_STARTING?
Command or Code
this.media=newMedia(src,successCallback,failureCallback,statusCallback,durationUpdateCallback);// The order of the following two doesn't matterthis.media.seekTo(seconds*1000);this.media.play();
I managed to get it working with this workaround:
if(this._mediaStatus===null||this._mediaStatus<MEDIA_RUNNING){// The media is not ready yet, seek as soon as we get a MEDIA_RUNNING statusthis._seekToSecondsWhenReady=seconds;}else{this.media.seekTo(seconds*1000);}
Bug Report
Problem
Calling
.play()
and.seekTo()
immediately one after the other causes an error on Android.What is expected to happen?
It should start playing from the given position.
What does actually happen?
It doesn't play, and produces the following error via the error callback:
This is also logged:
Information
I searched for this error code, and it appears that the problem is that
player.start()
is called before theonPrepared
callback is fired.After digging into the implementation (
AudioPlayer.java
), I found that both thestartPlaying
andseekToPlaying
callreadyPlayer()
and only do stuff immediately ifreadyPlayer()
returns true, otherwise will set some values to do it in the callback once the player is ready.readyPlayer()
creates the player if it doesn't exist yet, and it looks like it is meant to return false if the player is not ready; however it seems to return true in theMEDIA_STARTING
as well.I'm wondering if there is any reason for it to return true while
MEDIA_STARTING
?Command or Code
I managed to get it working with this workaround:
Environment, Platform, Device
Version information
Android version: 11
Checklist
The text was updated successfully, but these errors were encountered: