2

我想一个接一个地播放视频。

此代码正在运行,但是在视频结束时,在开始第二个视频之前,我得到了空白帧。

<VideoView 
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:id="@+id/video"
        />

诠释 i = 0; 列出 videoPathes = new ArrayList(); 私人 VideoView 视频视图;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        videoview = (VideoView) findViewById(R.id.video);
        videoPathes.add("http://192.168.1.8/User_files/VID_20130422_124555.3gp");


    videoPathes.add("http://192.168.1.8/User_files/VID_20130422_124609.3gp");
            videoview.setVideoPath(videoPathes.get(i));
            videoview.setMediaController(new MediaController(this));
            videoview.start();


            videoview.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {

                    public void onCompletion(final MediaPlayer mp) {

                         i = (i + 1) % videoPathes.size();

                         videoview.setVideoPath(videoPathes.get(i));
                         videoview.start();
                            }
            });
4

0 回答 0