4

代码运行良好,但我得到这个错误日志的方式

错误日志:

08-28 08:44:24.281: E/MediaPlayer(32454): mOnVideoSizeChangedListener is null. Failed to send MEDIA_SET_VIDEO_SIZE message.

我尝试将音频文件转换为不同的格式设置听众等等......我真的需要这个帮助。她是整个 MediaPlayer 日志:

日志:

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;
    }
4

3 回答 3

2

我设法通过附加一些空听众来摆脱错误。请参阅http://developer.android.com/reference/android/media/MediaPlayer.html上的 setOnPreparedListener() 和类似方法

于 2012-09-24T10:13:52.503 回答
0

我是否理解正确,您的应用程序有效,而您只是想知道记录的错误?我认为 MediaPlayer 只是尝试调用所有定义的回调方法,而不考虑具体的文件/编解码器。正如您在日志文件中看到的那样,还有其他几个为 null 的回调,例如mOnCompletionListenermOnPreparedListener。所以我不会对此过于担心。

于 2012-08-28T12:10:36.810 回答
0

你是说aac吗?但是MediaPlayer不支持aac。

于 2012-08-28T11:20:50.223 回答