我想執行VideoVew
中的重播功能。我在API
等級18+中成功實施,但在低於API
的等級中未能工作。 當我點擊重播按鈕VideoVew
凍結,不會再次啓動。Videoview重播功能不適用於API級別17及以下
holder.videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(final MediaPlayer mp) {
holder.replay.setVisibility(View.VISIBLE);
holder.videoView.setVisibility(View.VISIBLE);
holder.pauseButton.setVisibility(View.GONE);
holder.playButton.setVisibility(View.GONE);
holder.mediaControls.setVisibility(View.GONE);
holder.progressBar.setVisibility(View.GONE);
removeProgressBar();
}
});
holder.replay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
updateProgressBar();
holder.imagePreview.setVisibility(View.GONE);
holder.replay.setVisibility(View.GONE);
holder.videoView.seekTo(0);
holder.videoView.start();
}
});
共享您重播點擊收聽代碼 –