android:使用默认视频播放器 [英] android: using default video player
本文介绍了android:使用默认视频播放器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个播放视频文件的应用程序.
I have an application that plays video files.
我一直在使用代码来使用Videoview
,并手动启动Videoview
来播放视频文件.但是,我只是想知道是否可以使用android的默认媒体播放器或视频播放器,而不是创建或使用VideoView
播放文件.
I have been using code for using Videoview
and starting the Videoview
manually to play video files. However, I just wanted to know if I can use the default media player or video player of android rather than creating or using the VideoView
to play the file..
如果问题不清楚,请发表评论.
Please make comments if the question is not clear.
非常感谢
推荐答案
可以-只需在文件Uri
中使用Intent
.
Sure - just use an Intent
with the file Uri
.
File file = new File("fileUri");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "video/*");
startActivity(intent);
这篇关于android:使用默认视频播放器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文