Android在原始文件夹中播放视频(从Intent启动画廊) [英] Android play video in raw folder (launching gallery from intent)

查看:420
本文介绍了Android在原始文件夹中播放视频(从Intent启动画廊)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我知道对此有很多问题,但是似乎所有人都有相同的答案,这不是我想要的.

So I know there are a lot of questions on this, but all seem to have the same answer and it's not what I'm looking for.

我在项目的raw文件夹中有一个视频,我可以使用VideoView在我的应用程序中播放该视频.但是,我想利用所有电话随附的图库视频播放器,以便用户可以暂停或滚动视频.

I have a video in the raw folder in my project, and I can get it to play in my app with VideoView. However, I would like to take advantage of the gallery video player that all phones come with so the user can pause or scroll through the video.

当我尝试使用ACTION_VIEW意向打开视频时,似乎没有能够处理此意向的应用程序.我的手机的文件夹中有相同的视频,图库播放器可以正常播放.我还下载了VLC,但列表中仍未显示任何应用程序.只是不可能,还是我错过了什么?

When I try to open my video with an ACTION_VIEW intent, it appears that there are no apps that can handle the intent. I have the same video in a folder in my phone, and the gallery player can play it fine. I also downloaded VLC but still no apps show up in the list. Is it just not possible, or am I missing something?

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("android.resource://" + ActivityMain.PACKAGE_NAME + "/" + R.raw.test));
intent.setDataAndType(Uri.parse("android.resource://" + ActivityMain.PACKAGE_NAME + "/" + R.raw.test), "video/*");
startActivity(Intent.createChooser(intent, "Complete action using"));

推荐答案

很少有应用程序支持android.resource方案.将视频复制到文件中进行播放,或嵌入自己的视频播放器.

Very few apps support the android.resource scheme. Copy the video to a file and play that, or embed your own video player.

这篇关于Android在原始文件夹中播放视频(从Intent启动画廊)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆