Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android: using default video player

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

like image 282
Farhan Avatar asked Oct 26 '11 22:10

Farhan


1 Answers

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);
like image 88
Michell Bak Avatar answered Oct 21 '22 07:10

Michell Bak