0

我正在使用 vitamio 库来播放 flv 视频。以下是我的 VideoWrapper 活动:

public class VideoWrapperActivity extends Activity {

    private String videoPath = null;
    private VideoView mVideoView;
    int chaperPlaying = 0;
    MediaController mController;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this))
            return;
        setContentView(R.layout.videoview);
        mVideoView = (VideoView) findViewById(R.id.surface_view);
        Constants.gotCourse = true;
        if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this))
            return;
        setContentView(R.layout.videoview);
        init();

        mVideoView = (VideoView) findViewById(R.id.surface_view);
        mVideoView.setVideoPath(videoPath);
        mVideoView.setVideoQuality(MediaPlayer.VIDEOQUALITY_HIGH);
        mVideoView.setMediaController(new MediaController(this));
        mVideoView.setOnCompletionListener(new OnCompletionListener() {

            @Override
            public void onCompletion(MediaPlayer arg0) {
                Log.d(Constants.TAG,"Completed");
                Intent returnIntent = new Intent();
                setResult(RESULT_CANCELED, returnIntent);  
                finish();   

            }
        });
    }

    private void init(){
        Bundle extras = getIntent().getExtras();
        chaperPlaying = extras.getInt("chaptertoplay",1);
        if(extras.getString("videofile").length() >0){
            videoPath = extras.getString("videofile");
        }

        Log.d(Constants.TAG,"Video File: "+videoPath);
        Log.d(Constants.TAG,"Current Chapter: "+chaperPlaying);
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        if (mVideoView != null)
            mVideoView.setVideoLayout(VideoView.VIDEO_LAYOUT_SCALE, 0);
        super.onConfigurationChanged(newConfig);
    }
}

我从处理播放视频和测验等的 MovieWrapper Activity 中调用此活动。我正在开始以下活动:

Intent intent = new Intent(MovieWrapperActivity.this, VideoWrapperActivity.class);
                intent.putExtra("chaptertoplay", currentChap);
                intent.putExtra("videofile",  Constants.mCourse.getmChapters().get(currentChap).getVideoURL());
                startActivityForResult(intent, MOVIE_WRAPPER);

第一次视频播放正确。但是当我通过调用上面的代码播放下一个视频时。我的两个活动都被关闭并且没有错误。以下是我的日志:

04-18 15:36:05.169: D/HFI(31808): Video File: http://server.com/VC_701_02.flv
04-18 15:36:05.169: D/HFI(31808): Current Chapter: 1
04-18 15:36:05.169: D/HardwareRenderer(31808): Disabling v-sync
04-18 15:36:05.269: W/Adreno200-EGLSUB(31808): SetSwapInterval() interval: 0 not set
04-18 15:36:05.319: I/Vitamio[Player](31808): VPLAYER INIT BEGIN
04-18 15:36:05.319: I/Vitamio[Player](31808): Copyright (c) VOV IO (http://vov.io).
04-18 15:36:05.319: I/Vitamio[Player](31808): THIS SOFTWARE (Vitamio) IS WORK OF VOV IO (http://vov.io)
04-18 15:36:05.319: I/Vitamio[Player](31808): Application package name: uk.org.humanfocus.hfi
04-18 15:36:05.319: D/Vitamio[Player](31808): RENDER RGB
04-18 15:36:05.319: I/Vitamio[Player](31808): VPLAYER INIT END
04-18 15:36:05.319: I/Vitamio[Player](31808): Copyright (c) VOV IO (http://vov.io).
04-18 15:36:05.319: I/Vitamio[Player](31808): THIS SOFTWARE (Vitamio) IS WORK OF VOV IO (http://vov.io)
04-18 15:36:05.319: I/Vitamio[Player](31808): Application package name: uk.org.humanfocus.hfi
04-18 15:36:05.319: D/Vitamio[Player](31808): SURFACE INIT OK
04-18 15:36:05.319: I/Vitamio[Player](31808): Copyright (c) VOV IO (http://vov.io).
04-18 15:36:05.319: I/Vitamio[Player](31808): THIS SOFTWARE (Vitamio) IS WORK OF VOV IO (http://vov.io)
04-18 15:36:05.319: I/Vitamio[Player](31808): Application package name: uk.org.humanfocus.hfi
04-18 15:36:05.319: D/Vitamio[Player](31808): SURFACE INIT OK
04-18 15:36:05.319: D/Vitamio[Player](31808): prepareAsync
04-18 15:36:05.319: I/Vitamio[Player](31808): PREPARE SIG: 0
04-18 15:36:05.329: D/Vitamio[Player](31808): THREAD NOTIFY START
04-18 15:36:05.339: I/Vitamio[Player](31808): THREAD PREPARE START
04-18 15:36:05.339: I/Vitamio[Player](31808): THREAD PREPARE ATTACHED
04-18 15:36:05.339: I/Vitamio[Player](31808): Copyright (c) VOV IO (http://vov.io).
04-18 15:36:05.339: I/Vitamio[Player](31808): THIS SOFTWARE (Vitamio) IS WORK OF VOV IO (http://vov.io)
04-18 15:36:05.349: I/Vitamio[Player](31808): OPEN FILE http://83.170.72.102/content/700_719/VC_701_02.flv
04-18 15:36:05.739: D/Vitamio[Player](31808): pthread_kill 0
04-18 15:36:05.749: I/Vitamio[Player](31808): PREPARE HANDLER 12
04-18 15:36:05.749: I/Vitamio[Player](31808): THREAD PREPARE DETTACHED
04-18 15:36:05.749: D/Vitamio[Player](31808): pthread_join 0
04-18 15:36:05.749: I/Vitamio[Player](31808): FILE CLOSE BEGIN
04-18 15:36:05.749: I/Vitamio[Player](31808): CLOSE AVFORMAT BEGIN
04-18 15:36:05.769: I/Vitamio[Player](31808): CLOSE AVFORMAT END
04-18 15:36:05.769: I/Vitamio[Player](31808): FREE VIDEOPIC BEGIN
04-18 15:36:05.769: I/Vitamio[Player](31808): FREE VIDEOPIC 2 END
04-18 15:36:05.769: I/Vitamio[Player](31808): FREE SUBPIC BEGIN
04-18 15:36:05.769: I/Vitamio[Player](31808): FREE SUBPIC 4 END
04-18 15:36:05.769: I/Vitamio[Player](31808): FREE AUDIOFRAME BEGIN
04-18 15:36:05.769: I/Vitamio[Player](31808): FREE AUDIOFRAME 8 END
04-18 15:36:05.769: I/Vitamio[Player](31808): DELETE GLOBAL REF BEGIN
04-18 15:36:05.769: I/Vitamio[Player](31808): DELETE GLOBAL REF END
04-18 15:36:05.769: I/Vitamio[Player](31808): FILE CLOSE END
04-18 15:36:05.769: I/Vitamio[Player](31808): VPLAYER RELEASE BEGIN
04-18 15:36:05.769: D/Vitamio[Player](31808): THREAD NOTIFY END
04-18 15:36:05.769: I/Vitamio[Player](31808): VPLAYER RELEASE END
04-18 15:36:05.769: A/libc(31808): Fatal signal 11 (SIGSEGV) at 0x00002840 (code=1), thread 31871 (.humanfocus.hfi)
04-18 15:36:05.809: A/libc(31808): Fatal signal 11 (SIGSEGV) at 0x00002814 (code=1), thread 31869 (.humanfocus.hfi)
04-18 15:36:08.359: E/Trace(31904): error opening trace file: No such file or directory (2)
04-18 15:36:08.379: V/ActivityThread(31904): uk.org.humanfocus.hfi white listed for hwui
04-18 15:36:08.959: D/HardwareRenderer(31904): Disabling v-sync
04-18 15:36:08.989: D/HardwareRenderer(31904): Disabling v-sync
04-18 15:36:09.069: D/libEGL(31904): loaded /system/lib/egl/libEGL_adreno200.so
04-18 15:36:09.089: D/libEGL(31904): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
04-18 15:36:09.089: D/libEGL(31904): loaded /system/lib/egl/libGLESv2_adreno200.so
04-18 15:36:09.189: D/OpenGLRenderer(31904): Enabling debug mode 0
4

2 回答 2

0

下次播放时,应在 videoView 之前释放。

于 2013-10-31T02:36:04.337 回答
0

当我更改编解码器时,我遇到了同样的问题,它工作正常。请使用此编解码器 recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);

于 2014-03-12T10:54:59.757 回答