android: using default video player

南笙酒味 提交于 2019-12-12 11:04:04

问题


I have an application that plays video files.

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.

Thanks alot


回答1:


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


来源:https://stackoverflow.com/questions/7909634/android-using-default-video-player

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!