android - Firebase 视频到 videoview 不起作用
问题描述
我能够录制并能够从我的 android 应用程序将该视频上传到 firebase,但无法播放或流式传输(无论可能)到 videoview。我实际上是在尝试进入回收站视图,但由于尝试更简单的方法没有用。
我在 stackoverflow 中阅读了很多帖子,并尝试了几乎所有的帖子,但都没有奏效。所以发布了新问题。
我的代码如下:
VideoView video;
//String video_url = "http://file2.video9.in/english/movie/2014/x-men-_days_of_future_past/X-Men-%20Days%20of%20Future%20Past%20Trailer%20-%20[Webmusic.IN].3gp";//this one works if i use it
String video_url = "https://firebasestorage.googleapis.com/longidcharacters-video.mp4?alt=media&token=xxxxx";
//but this link from firebase does not work, i usually fetch it from online
ProgressDialog pd;
Button playButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show_video);
video = (VideoView) findViewById(R.id.Videoview1);
playButton=(Button) findViewById(R.id.playButton1);
pd = new ProgressDialog(ShowVideoActivity.this);
pd.setMessage("Buffering video please wait...");
pd.show();
Uri uri = Uri.parse(video_url);
video.setVideoURI(uri);
video.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
//close the progress dialog when buffering is done
pd.dismiss();
}
});
playButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
video.start();
}
});
它说“无法播放此视频”。格式为mp4(从相机录制)。但是,如果我玩那个 3gp 的(现在已评论),它工作正常。我能做些什么?有没有什么播放器可以试试?我只是想流式传输或播放上传到 Firebase 存储的视频。
解决方案
推荐阅读
- java - 有字符串 "naveen" ,希望输出为 "eennav"
- javascript - 猫鼬中的同步和异步与回调
- xml - 如何在 apache camel 中从源路由器动态获取值到目标路由器(这里源是 kafka 主题,目标是休息端点))
- shell - 使用 Shell.FlyoutHeader 删除 Xamarin.Forms Shell 的 Humberger 菜单中的自动生成按钮
- scala - Spark MapPartition NullPointerException 错误
- typescript - Typescript 基于嵌套成员推断父类型
- node.js - Nodejs:请求以不完整的数据结束
- javascript - 无论如何“动态”地将变量从 C# 传递给 javascript?
- ruby-on-rails - 在 Digital Ocean 上部署 Rails 应用程序并在运行 cap production deploy:initial I get back ---> 01 ArgumentError: Missing `secret_key_base`
- c# - 如何在使用c#列出文本文件中的所有数据之前预写标题