android: using default video player

2019-06-27 13:02发布

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条回答
\"骚年 ilove
2楼-- · 2019-06-27 13:23

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);
查看更多
登录 后发表回答