未调用Vitamio媒体播放器onCompletion Listner

时间:2015-07-14 06:27:06

标签: android

我正在使用vitamio SDK我已编写如下代码,但未调用onCompletion侦听器。

 mediaPlayer = new MediaPlayer(this);
            Utils.showLog(TAG, "Alert video path to be play : " + path);
            mediaPlayer.setDataSource(path);
            mediaPlayer.setDisplay(sholder);
            mediaPlayer.setBufferSize(1024 * 256);
            mediaPlayer.prepareAsync();


            mediaPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK);
            mediaPlayer.setOnPreparedListener(this);
            mediaPlayer.setOnErrorListener(this);
            mediaPlayer.setOnVideoSizeChangedListener(this);
            mediaPlayer.setOnInfoListener(this);

并在视频开始后设置onCompletion侦听器

 mediaPlayer.setOnCompletionListener(this);

1 个答案:

答案 0 :(得分:0)

setOnCompletionListener上的{p> VideoView代替MediaPlayer

        videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mp) {
                VideoPlayerActivity.this.finish();
            }
        });

<强>更新

我认为问题在于你的进口。 导入后仔细检查。

import io.vov.vitamio.MediaPlayer.OnCompletionListener;