Android MediaPlayer throwing “Prepare failed.: status=0x1” on 2.1, works on 2.2

后端 未结 15 1032
独厮守ぢ
独厮守ぢ 2020-11-27 17:17

I\'ve been really banging my head against the table trying to get the MediaPlayer class to try to play h.264-encoded videos on Android 2.1. My code is rather simple:

<
15条回答
  •  遥遥无期
    2020-11-27 18:06

    first thanks for your code, the open raw ressource helped me with my problem.

    I'm sorry I don't have a definite answer to your problem but based on the api media example in the SDK and my media player in my project I would suggest checking that the file opens correctly.

    otherwise maybe you need to set the display before preparing as such:

    mMediaPlayer = new MediaPlayer();
                mMediaPlayer.setDataSource(fileDescriptor.getFileDescriptor(), fileDescriptor.getStartOffset(), fileDescriptor.getDeclaredLength());
                mMediaPlayer.setDisplay(holder);
                mMediaPlayer.prepare();
    

    those are the only ideas I have

    hope it helps

    Jason

提交回复
热议问题