vendredi 24 juin 2016

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

Aucun commentaire:

Enregistrer un commentaire