我使用mediaPlayer和surfaceView来读取这样的视频:
mSurfaceHolder = mSurfaceView.getHolder();
mSurfaceHolder.addCallback(this);
mMediaPlayer.setDataSource(this, uriVideo);
mMediaPlayer.prepare();
mMediaPlayer.setOnPreparedListener(this);
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
}
@Override
public void onPrepared(MediaPlayer mp) {
mMediaPlayer.start();
}
问题是,某些类型的视频(.avi,.mkv,...)无法在此播放器上运行,同样的视频也适用于其他视频播放器,如VLC播放器;我收到此错误
java.io.IOException: setDataSource failed.: status=0x80000000
at android.media.MediaPlayer._setDataSource(Native Method)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1113)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1070)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1009)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:956)
at com.geniussecurity.pleo.VideoActivity.surfaceCreated(VideoActivity.java:385)
at android.view.SurfaceView.updateWindow(SurfaceView.java:583)
at android.view.SurfaceView.access$000(SurfaceView.java:88)
at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:177)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:847)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1880)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1006)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5652)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5426)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(Native Method)
请帮助。
答案 0 :(得分:1)