Video streaming & subscribing with Red5 Pro in Xamarin Forms

Ha Do
naxam-blogs
Published in
2 min readDec 8, 2017

--

Use Red5 Pro SDK in Xamarin Forms projects

What’s Red5 Pro?

Image Source: Red5 Pro

Red5 Pro is a live streaming platform which is built on Red5 media server and claimed to be low latency and scalable. Aside HTML5 supports, the company also provided iOS & Android SDKs allowing to broadcast and subscribe to a live stream containing audio and video.

Their documentations are quite straight-forward, so in this article, we will only talk about Xamarin Forms :)

In order to make these work in Xamarin, our team has created relatively Objective-C & Java binding libraries, and a Xamarin Forms control which lessens the pain of running around those platforms. See what you can accomplish:

Before getting started

You will need a running Red5 server and a license key before playing with our libraries. Please create a new account and follow their instructions.

Using Naxam’s Red5 Pro control for Xamarin Forms

Publishing

As simple as the native solution is, to start a streaming session, all you need to do are:

  1. Add the package Naxam.Red5Pro.Forms into PLC, iOS & Android projects
  2. Bring the control into your view:
xmlns:controls="clr-namespace:Naxam.Controls.Red5Pro.Forms;assembly=Naxam.Red5Pro.Forms"<controls:VideoView x:Name="videoView" ShowDebugsInfo="true"/>

3. Give it some configurations:

videoView.Configuration = new  Naxam.Controls.Red5Pro.Forms.R5FConfiguration() {
Host = host,
Port = port,
ContextName = contextName,
LicenseKey = licenseKey
};

4. Of course video streaming needs a camera:

videoView.Camera = new R5FCamera();

5. Show preview before broadcasting to make sure you look good on the screen:

videoView.ShowPreview(true);

6. Then publish your images to the world:

videoView.Publish(StreamName, R5FRecordType.Live);

Subscribing

1– 4. The same to the previous section

5. You may want to specify the video controller:

videoView.AudioController = new R5FAudioController(R5FAudioControllerMode.EchoCancellation );

or

videoView.AudioController = new R5FAudioController(R5FAudioControllerMode.StandardIO)

6. Play the stream:

videoView.Play(streamName);

If every configuration is correct and your server is running, your subscribing session should start.

Wraps up

Video streaming is not something new and Red5 Pro is not the only solution. However we believe that this control is a good choice in this area. If you interest in Naxam’s Red5 Pro control for Xamarin Forms, or any mobile development issue, please do not be hesitate to contact us.

--

--