Search code examples
androidvideortmp

Android: how to send a rtmp stream address to an external videoplayer (e.g. MX player)


Like my question states, how do i sent a rtmp stream address to an external media player?

Mx Player is able to play my stream but i'm unable to sent the address to it. I've tried this:

    String videoUrl = "rtmp://mystream";
    Intent i = new Intent(android.content.Intent.ACTION_VIEW);
    i.setDataAndType(Uri.parse(videoUrl), "video/*");
    startActivity(i);

but it only works with online videos, my rtmp gives me an application error.


Solution

  • MX Video Player does not support the combination of the scheme rtmp and MIME type video/*. To successfully use it to open an RTMP URI, change your code as follows.

    String videoUrl = "rtmp://mystream";
    Intent i = new Intent(android.content.Intent.ACTION_VIEW);
    i.setData(Uri.parse(videoUrl));
    startActivity(i);
    

    The scheme alone will be enough for MX Video Player to capture the Intent.