How to play a media file/stream from console in Android

Document created by Jian Li Employee on Oct 9, 2012Last modified by Jodi Paul on Mar 12, 2013
Version 4Show Document
  • View in full screen mode

When streaming, if you want to play a streaming URL, it can be inconvenient if the browser cannot recognize the URL as a media stream and downloads the content rather than using Gallery to play it.

To create this kind of media streaming, you need to write an apk to use VideoView to play the URL/media stream from the console.


Here is the command of how to play a media file or network stream from console.



am start -n -d "<URL>"

      The URL can be file position or network stream URL, such as:

  • you can play a local file by:

am start -n -d "/mnt/sdcard/test.mp4"

  • You can also play a http stream by:

am start -n -d ""

  • Or play a rtsp stream by:

am start -n -d "rtsp://"



am start -n -d "<URL>"

       The URL has the same definition of Gingerbread.