如何启用视频在列表视图在选择序列自动播放?视图、序列、自动播放、列表

2023-09-04 06:05:58 作者:窒息.

您好家伙和我一起上我怎么到code我viewvideo.java类可有人份额,使得它允许自动播放视频功能,可以自动序列在列表视图中播放所选择的视频的任务(从目前的位置到最新的视频记录的顺序,直到符合最新的视频播放完毕),这是类似于YouTube的自动播放功能的东西,如果你明白我的意思吗?

Hello guys can someone share with me on how am i going to code my viewvideo.java class such that it allow auto-play video function which automatically sequence the task of playing the selected video in a listview (from current position to the latest video recorded in sequence until the latest video in line has finished playing) which is something similar to the youtube auto-play function if you know what i mean?

有人可以帮助我关于这个问题,我面对现在我心里有些很新至Android / Java编程和一直停留在这个问题上的天......对不起,我的英语不好上面..

Can someone help me pertaining to this problem i'm facing now i'm rather quite new to android/java programming and have been stuck on this problem for days... Sorry for my bad English above..

推荐答案

我认为所有你需要做的就是调用 videoView.setVideoPath(next_file_path),然后调用 videoView.start()。如果没有更多的视频,然后调用 videoView.stopPlayback()

I think that all you need to do is call videoView.setVideoPath(next_file_path) and then call videoView.start(). If there are no more videos, then call videoView.stopPlayback().

下面是一些可能的工作:

Here's something that might work:

@Override
public void onClick(DialogInterface dialog, int which) {
    if (arg1 == 0) {
        Intent intentInfo = new Intent(ListViewActivity.this, DialogBox.class);
        // Retrieve the path names of all videos from the top to the
        // selected item (inclusive).
        arrayPath = new String[selectedPosition+1];
        for (int i = 0; i <= selectedPosition; ++i) {
            arrayPath[i] = videoItems.get(i).absolutePath;
        }
        VideoInfo info = videoItems.get(selectedPosition);
        intentInfo.putExtra("fileName", info.name);             
        intentInfo.putExtra("fileSize", info.size);
        intentInfo.putExtra("absolutePath", info.absolutePath);
        intentInfo.putExtra("arrayPath", arrayPath);

        startActivity(intentInfo);  
    }
    else
    {
        deleteFile();
    }
}

这传递路径名的数组你DialogBox的活动(你还没有发布)。然后,您应该能够检索 arrayPath 和如果用户选择播放的所有视频将它传递给VideoView活动。

This passes the array of path names to your DialogBox activity (which you haven't posted). You should then be able to retrieve arrayPath and pass it on to the VideoView activity if the user selects to play all videos.

 
精彩推荐
图片推荐