Can Android natively play udp / RTP /RTSP Streams?
11,532
Yes, you can use e.g. the android.media.MediaPlayer
class to do this. See http://developer.android.com/guide/topics/media/mediaplayer.html for more information about how to do it.
Author by
user1767754
Updated on June 05, 2022Comments
-
user1767754 almost 2 years
I am a bit confused, is it possible to receive UDP / RTSP Streams with the Android SDK? I've searched for some solution, but obviously they are just forwarding the request to the android native player or vlc. I would like to playback a video-feed in a surface-view for example.
Is it possible to receive streams without using third-party api's like ffmpeg?
-
user1767754 over 9 yearsIs this performant as well? I know that for example vlc playr has bad performance compare to ffplay from ffmpeg? but thanks for the answer so far
-
mstorsjo over 9 yearsThis class should use the same hardware codecs as the native player app, and should otherwise be pretty much the same (unless the native player app has got a lot of customization), so it should be quite performant.
-
user1767754 over 9 yearsIn the docs it says " If you're passing a URL to stream an online media file, the file must be capable of progressive download." Will this work with udp streaming?
-
mstorsjo over 9 yearsIt will work with RTSP streaming over RTP/UDP yes. (It doesn't support other generic streaming protocols over UDP though.)
-
user1767754 over 9 yearsvid.setVideoURI(Uri.parse("udp://@192.168.1.142:1234")); should this work?
-
mstorsjo over 9 yearsNo, you can't use direct UDP urls, you need to set it up via an RTSP url.
-
mstorsjo over 9 yearsThen you would have to manually set up UDP sockets for receiving data, manually parse the packets and feed it to MediaCodec for decoding. It of course is possible but then you have to do almost everything of it manually in your own code.
-
Ivan Verges almost 9 yearsSome devices support a RAW UDP Stream like: "udp://@224.1.1.1:5000", using the common MediaPlayer class, but some others doesn't support that kind of playback. I'm trying to find a way to make a generic player that support this kind of UDP Stream like the VLC does, may somebody give me a clue of how to get it work?
-
Dr.jacky over 8 years@mstorsjo Do you have any sample application that play RTP over UDP? please