Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi! This is my first question on Code Project.

I'm making an Android app. In one of the activities I play videos. When one video ends, the second is supposed to start.

At the moment this part of my Java file plays one video:
@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_watch);
		
		VideoView vidView = (VideoView)findViewById(R.id.myVideo);
		
		String vidAddress = "https://archive.org/download/ksnn_compilation_master_the_internet/ksnn_compilation_master_the_internet_512kb.mp4";
		Uri vidUri = Uri.parse(vidAddress);
		
		vidView.setVideoURI(vidUri);
		
		vidView.start();
	}


When this video ends I'm supposed to play the second one. I will probably number the videos so that I can sequence through them.

But my question is:
How can I know when someone's finished watching the first video? I don't allow controls (like forwarding) so that they don't skip any videos. But I don't want them to move on to the second video by closing the app halfway through the first video, for example. So, how can I know when they've finished the first video, and how can I dynamically change the video being played (e.g. video5.mp4)?
Posted

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900