Android MP4 Stream - Cannot Play Video

So, I am transferring the video from the URL to the androids video and its MP4 video.

Here is my code:

String LINK = "String LINK = "http://www.fieldandrurallife.tv/videos/Benltey%20Mulsanne.mp4"; setContentView(R.layout.video); VideoView videoView =(VideoView)findViewById(R.id.video); MediaController mc = new MediaController(this); mc.setAnchorView(videoView); mc.setMediaPlayer(videoView); Uri video = Uri.parse(LINK); videoView.setMediaController(mc); videoView.setVideoURI(video); videoView.requestFocus(); videoView.start();"; 

I get a dialog box that says "This video cannot be played", but if I change the link URL to " http://www.boisestatefootball.com/sites/default/files/videos/original/01%20-%20coach% 20pete% 20bio_4.mp4 "Then it works! Does anyone know why? and how can i fix it?

Many thanks

+4
source share
1 answer

Try it, he played a video for me

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <VideoView android:id="@+id/videoViewa" android:layout_width="match_parent" android:layout_gravity="center" android:layout_height="match_parent" /> 

  VideoView videoView; videoView = (VideoView) findViewById(R.id.videoViewa); MediaController mediaController = new MediaController(this); mediaController.setAnchorView(videoView); //URI either from net Uri video = Uri.parse("http://www.fieldandrurallife.tv/videos/Benltey%20Mulsanne.mp4"); videoView.setMediaController(mediaController); videoView.setVideoURI(video); videoView.start(); 
+4
source

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


All Articles