无法通过SurfaceView android在sdCard中播放视频* .mp4

时间:2015-08-10 03:06:26

标签: android-mediaplayer

我在sdCard中有一个视频.mp4,如果通过VideoView播放视频,则播放Ok。但是如果 我用SurfaceView播放这个视频。我无法播放。请帮帮我。非常感谢你!这是我的代码播放视频使用SurfaceView

String pathVideo = watchIntent.getStringExtra("pathFileVideo");
        SurfaceHolder videoHolder = videoSurface.getHolder();
        videoHolder.addCallback(this);
        mPlayer = new MediaPlayer();
        controller = new VideoControllerView(mContext);
        try {
            mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
            mPlayer.setDataSource(pathVideo);
            mPlayer.setOnPreparedListener(this);
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (SecurityException e) {
            e.printStackTrace();
        } catch (IllegalStateException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

0 个答案:

没有答案