Search code examples
androidvideo-streamingmedia-player

Play video from url in default android player


    Intent i = new Intent(Intent.ACTION_VIEW);
    i.setData(Uri.parse(videoUrl));
    mContext.startActivity(i);

The code above opens the default web browser to show the video. How could I make it open the default video player?


Solution

  • There is no guaranteed way, as "the default video player" varies by device, and there is no guarantee that it can handle your request.

    To help, you can add the MIME type, by using setDataAndType() instead of setData().