How to do auto play, for example facebook in the list, only one video at a time, and pause it when it goes out of focus.
Below is the code for playing video after OnClick, in the video viewing mode in another activity, I want it to scroll and automatically play the video like Facebook.
Videos_URL = intent.getExtras().getString("VideoUrl"); // Find your VideoView in your video_main.xml layout myVideoView = (VideoView) findViewById(R.id.videoview); if (mediaControls == null) { mediaControls = new MediaController(this); } // Create a progressbar progressDialog = new ProgressDialog(this); // Set progressbar title progressDialog.setTitle("APPNAME Video "); // Set progressbar message progressDialog.setMessage("Loading..."); progressDialog.setCancelable(false); // Show progressbar // Show progressbar progressDialog.show(); try { Uri video = Uri.parse(Videos_URL); myVideoView.setVideoURI(video); myVideoView.setMediaController(mediaControls); myVideoView.start();
Can I get auto play in video view mode in Android?
source share