gpt4 book ai didi

Android MP4 流 - 无法播放视频

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:10:10 25 4
gpt4 key购买 nike

所以我正在将视频从 URL 流式传输到 android 视频 View 及其 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();";

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

非常感谢

最佳答案

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

 <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();

关于Android MP4 流 - 无法播放视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18206616/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com