Play video from url in VideoView [Android]
Try this code.. This code works perfectly for me..
VideoView videoView = findViewById(R.id.videoView);
videoView.setVideoPath("http://videocdn.bodybuilding.com/video/mp4/62000/62792m.mp4");
videoView.start();
For me, changing the URL from
"http://videocdn.bodybuilding.com/video/mp4/62000/62792m.mp4"
to:
"https://videocdn.bodybuilding.com/video/mp4/62000/62792m.mp4"
made it work.
In other words, I used HTTPS instead of HTTP.
I used the following code to start the video:
final VideoView videoView = findViewById(R.id.videoview); //id in your xml file
videoView.setVideoURI(Uri.parse(URL)); //the string of the URL mentioned above
videoView.requestFocus();
videoView.start();