无缝视频环与VideoView [英] Seamless video Loop with VideoView

查看:200
本文介绍了无缝视频环与VideoView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下的code拍摄录像作为原始资源,启动录像和循环,但我需要的视频无缝循环截至目前,当涉及到的剪辑的结束,并开始剪辑再一个闪烁的一瞬间,我真的不能对我的应用程序的原因之间的过渡。

I have the following code to take a video as a raw resource, start the video and loop it but I need the video to loop seamlessly as of now when it comes to an end of the clip and starts the clip again the transition between causes a flicker for a split second, which I really can't have for my app.

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秒长,但被创造是无缝所以它是可能的,而不延迟工作。

The clip is only 22 seconds long but was created to be seamless so it is possible to work without the delay.

推荐答案

答案,这是从视频中删除音频和将其转换为 .OGG 文件,该文件可以无缝地循环再利用视频无音频循环圆而工作的。

Answer to this is to remove the audio from the video and convert that to a .ogg file which can be looped seamlessly and then use the video without audio to loop round and this works.

这篇关于无缝视频环与VideoView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆