How to enable auto-play video in sequence after selecting in the list?

Hi guys, I can share with me how I will encode my viewvideo.java class so that it allows you to automatically play a video function that automatically performs the task of playing the selected video in a list (from the current position to the last video recorded in sequence to until the last video in the line finishes the game), which is similar to the youtube auto-play function, if you know what I mean?

Can someone help me in solving this problem that I am facing now, I am quite new to programming in Android and Java, and stuck to this problem for several days ... Sorry for my bad English above ..

0
source share
1 answer

I think all you have to do is call videoView.setVideoPath(next_file_path) and then call videoView.start() . If the video is no longer there, call videoView.stopPlayback() .

Something might work here:

 @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(); } } 

This passes an array of path names to your DialogBox activity (which you haven't posted yet). You can then get the arrayPath and pass it to the VideoView action if the user chooses to play all the videos.

0
source

Source: https://habr.com/ru/post/898976/


All Articles