I wrote a simple application which uses the MediaPlayer to play a video. The Video is in the 3gp file format. The Application is working on Android 4.x , but it reports error (1, -19) on Android 2.x . I have only one MediaPlayer Instance and the MediaPlayer reports that error when the MediaPlayer.start() method is called. The video stream is MPEG-4, and the mobile phone can play it in the default player.
我编写了一个简单的应用程序,它使用MediaPlayer来播放视频。视频是3gp文件格式。应用程序正在运行Android 4。但是它报告了Android 2上的错误(1,-19)。x。我只有一个MediaPlayer实例,而MediaPlayer报告当MediaPlayer.start()方法被调用时出错。视频流是MPEG-4,手机可以在默认播放器中播放。
Could anyone please tell me the way to solve this problem?
谁能告诉我解决这个问题的方法?
2 个解决方案
#1
0
Android media player is having its own complexities.I personally don't like MediaPlayer Api. Its better to use ExoPlayer. You can customise as per your requirement. If you are running out of time use some opensource projects like this
Android媒体播放器有它自己的复杂性。我个人不喜欢MediaPlayer Api。使用ExoPlayer比较好。您可以根据您的要求定制。如果您没有时间使用一些opensource项目,像这样。
#2
0
I add surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS) and solve the problem.And I don't know why the type isn't automatically set as it is supposed to be.
我添加了surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS)并解决了这个问题。我不知道为什么类型不会自动设置成它应该的样子。
#1
0
Android media player is having its own complexities.I personally don't like MediaPlayer Api. Its better to use ExoPlayer. You can customise as per your requirement. If you are running out of time use some opensource projects like this
Android媒体播放器有它自己的复杂性。我个人不喜欢MediaPlayer Api。使用ExoPlayer比较好。您可以根据您的要求定制。如果您没有时间使用一些opensource项目,像这样。
#2
0
I add surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS) and solve the problem.And I don't know why the type isn't automatically set as it is supposed to be.
我添加了surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS)并解决了这个问题。我不知道为什么类型不会自动设置成它应该的样子。