android multimedia programs, mediaplayer (-38, 0) error occurs when mediaplayer is called when mediaplayer is not synchronized (Prepared), or getDuration method is called.
A good solution is to set up the OnPreparedLisnter listener:
MediaPlayer.OnPreparedListener preparedListener = new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { mp.start(); total = mp.getDuration();// 总时长 } }; mp.setOnPreparedListener(preparedListener); mp.prepare();
This ensures that the start and getDuration methods are called after prepare.
Read More:
- [unity] Android package error java.lang.ClassNotFoundException Did not find class com.unity3d . player.MainActivity
- Neko RPGXP player for Korea
- Error: Error parsing D:\new_android\Android SDK\system-images\android-25\android-wear\armeabi-v7a\de
- solve error:legacy boot of uefi media
- Error building player because scripts have compile errors in the editor
- Android Studio | Failed to find target with hash string ‘android-26’ in: D:\Android\sdk
- How to solve the error loading media: file could not be played in jwplay
- Error building Player because scripts had compiler errors when packaging ab package
- The media could not be loaded, either because the server or network failed or because the format is
- Linux mounting errors (Error mounting /dev/sda8 at /media)
- Causes and solutions of WordPress media library pictures not showing or showing errors
- Error: Cannot retrieve repository metadata (repomd.xml) for repository: c6-media. Please verify…
- Perfectly solve the error loading media: file could not be played error
- [flash] error: “necessary system components are not working properly, please repair Adobe Flash Player” and error ා 2046
- Unity-failed to update unity web player
- Video player plays flv with error flv: Unsupported audio codec IDX: 7
- [Unity] Deterministic compilation failed. You can disable Deterministic builds in Player Settings Li
- Video JS can’t play the prompt( CODE:4 MEDIA_ ERR_ SRC_ NOT_ SUPPORTED) No compatible source was found for this video.
- [Solved] Unity Error: Deterministic compilation failed. You can disable Deterministic builds in Player Settings
- Adobe Flash player error (error # 2044)