简体   繁体   中英

Play H264 Video/Audio Stream (from existing RTP session) on Xamarin Android device (4.4+)

I am developing an App on Xamarin right now for Android, alter IOS. I have started a SIP session as a Client successfully and got a SDP.

With the session description I start my RTPClient (I am using Managed Media Aggregation ( https://net7mma.codeplex.com/ ) also successfully it seems.

I get an URI ending with a Media Port.

I have tried different ways to Play back that stream:

Android.Widget.VideoView:

videoview.SetVideoURI(Android.Net.Uri.Parse(fullPath));
videoview.Start();

says in a popup box "Cannot Playback Video" or something like this just in german in my case.

So I tried an Android.Media.MediaPlayer:

player.Reset();
player.SetDataSource(fullPath);
player.Prepare();

runs into an exception and

player.PrepareAsync();

seems to run nowhere.

Should These work somehow and am I just doing wrong?

Or must I give it more info like it is H.264 decoded, has 640x480 Pixels and more stuff I know exactly from my SDP media description?

I have taken a look into that MediaFormat and MediaCodec classes from Android but still do not know how to use them exactly for my case (RTP Connection with known Media description).

Thanks a lot and have a nice Weekend!

Eric

You should use an external component like the Google ExoPlayer to media with encoding. There is a Nuget package available for this: https://github.com/martijn00/ExoPlayerXamarin

That's my project... (net7mma) eg I am the Author...

You can use either the Rtsp or Rtp client quite easily and I have verified such in Android recently.

If you have specific questions make a thread in the project's home page and I will address it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM