我有以下代码将视频作为原始资源,启动视频并将其循环播放,但是从片段的结尾到现在,我需要视频才能无缝循环,然后再次开始播放片段,导致瞬间闪烁,我的应用程序确实无法做到这一点。
public class Example extends Activity {
VideoView vv;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
vv = (VideoView)findViewById(R.id.VideoView01);
//Video Loop
vv.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
vv.start(); //need to make transition seamless.
}
});
Uri uri = Uri.parse("android.resource://com.example/"
+ R.raw.video);
vv.setVideoURI(uri);
vv.requestFocus();
vv.start();
}
}
该剪辑只有22秒长,但是被创建为无缝的,因此可以毫无延迟地工作。