Android MP4 流 - 视频无法播放

Cha*_*ana 5 mp4 android video-streaming android-videoview

所以我将视频从 URL 流式传输到 Android 视频视图及其 MP4 中。

这是我的代码:

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();";
Run Code Online (Sandbox Code Playgroud)

我收到一个对话框,显示“此视频无法播放”,但如果我将链接网址更改为“ http://www.boisestatefootball.com/sites/default/files/videos/original/01%20-%20coach%20pete %20bio_4.mp4 " 然后就可以了!有谁知道为什么?我该如何解决它?

非常感谢

ble*_*sed 4

试试这个,它为我播放了视频

 <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" />
Run Code Online (Sandbox Code Playgroud)

            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();
Run Code Online (Sandbox Code Playgroud)