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

我是研究僧i 提交于 2019-12-10 17:51:08

问题


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.


回答1:


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.




回答2:


What you wrote there won't work, there is no native support for RTMP streams on Android.

However, you can use RTSP, as it is supported since API level 1.

If you still want to use RTMP, you may try this external library: http://code.google.com/p/android-rtmp-client/



来源:https://stackoverflow.com/questions/9057080/android-how-to-send-a-rtmp-stream-address-to-an-external-videoplayer-e-g-mx-p

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!