代码运行良好,但我是怎么得到这个错误日志的
错误日志:
08-28 08:44:24.281: E/MediaPlayer(32454): mOnVideoSizeChangedListener is null. Failed to send MEDIA_SET_VIDEO_SIZE message.
我尝试将音频文件转换为不同格式设置侦听器等…
我真的需要帮助。她是整个媒体播放器日志:
原木:
08-28 08:44:24.121: V/MediaPlayer-JNI(32454): native_setup
08-28 08:44:24.131: V/MediaPlayer(32454): constructor
08-28 08:44:24.146: D/dalvikvm(32454): GC_CONCURRENT freed 193K, 4% free 9397K/9735K, paused 2ms+2ms
08-28 08:44:24.146: V/MediaPlayer-JNI(32454): native_finalize
08-28 08:44:24.146: V/MediaPlayer-JNI(32454): release
08-28 08:44:24.146: V/MediaPlayer-JNI(32454): native_finalize
08-28 08:44:24.146: V/MediaPlayer-JNI(32454): release
08-28 08:44:24.186: V/MediaPlayer(32454): setListener
08-28 08:44:24.186: V/MediaPlayer-JNI(32454): setDataSourceFD: fd 47
08-28 08:44:24.186: V/MediaPlayer(32454): setDataSource(47, 740, 14519)
08-28 08:44:24.216: V/MediaPlayer(32454): setVideoSurfaceTexture
08-28 08:44:24.216: V/MediaPlayer(32454): prepare
08-28 08:44:24.246: V/MediaPlayer(32454): message received msg=5, ext1=0, ext2=0
08-28 08:44:24.246: V/MediaPlayer(32454): New video size 0 x 0
08-28 08:44:24.246: V/MediaPlayer(32454): callback application
08-28 08:44:24.246: V/MediaPlayer(32454): back from callback
08-28 08:44:24.246: V/MediaPlayer(32454): message received msg=1, ext1=0, ext2=0
08-28 08:44:24.246: V/MediaPlayer(32454): prepared
08-28 08:44:24.246: V/MediaPlayer(32454): signal application thread
08-28 08:44:24.246: V/MediaPlayer(32454): callback application
08-28 08:44:24.246: V/MediaPlayer(32454): back from callback
08-28 08:44:24.246: V/MediaPlayer(32454): prepare complete - status=0
08-28 08:44:24.246: V/MediaPlayer-JNI(32454): start
08-28 08:44:24.246: V/MediaPlayer(32454): start
08-28 08:44:24.281: E/MediaPlayer(32454): mOnVideoSizeChangedListener is null. Failed to send MEDIA_SET_VIDEO_SIZE message.
08-28 08:44:24.281: I/MediaPlayer(32454): Don't send intent. msg.arg1 = 0, msg.arg2 = 0
08-28 08:44:24.281: E/MediaPlayer(32454): mOnPreparedListener is null. Failed to send MEDIA_PREPARED message.
08-28 08:44:25.661: V/MediaPlayer(32454): message received msg=2, ext1=0, ext2=0
08-28 08:44:25.661: V/MediaPlayer(32454): playback complete
08-28 08:44:25.661: V/MediaPlayer(32454): callback application
08-28 08:44:25.661: V/MediaPlayer(32454): back from callback
08-28 08:44:25.666: E/MediaPlayer(32454): mOnCompletionListener is null. Failed to send MEDIA_PLAYBACK_COMPLETE message.
08-28 08:49:24.211: V/MediaPlayer-JNI(32454): release
08-28 08:49:24.211: V/MediaPlayer(32454): setListener
08-28 08:49:24.211: V/MediaPlayer(32454): disconnect
08-28 08:49:24.226: V/MediaPlayer(32454): destructor
08-28 08:49:24.226: V/MediaPlayer(32454): disconnect
和Java代码。
Java代码:
public class MainActivity extends Activity {
MediaPlayer TestingAudio;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Initialization();
DoStuff();
}
private void Initialization() {
setContentView(R.layout.activity_main);
TestingAudio = MediaPlayer.create(MainActivity.this, R.raw.samlagnin);
}
private void DoStuff() {
TestingAudio.start();
}
@Override
protected void onPause() {
super.onPause();
TestingAudio.release();
TestingAudio = null;
}
最佳答案
我设法通过附加一些空的侦听器来消除错误。请参见位于http://developer.android.com/reference/android/media/MediaPlayer.html的setonPreparedListener()和类似方法