Search code examples
androiddefaultplaybackandroid-videoview

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


Solution

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