Recently we had the need for supporting streaming and broadcast playback for one of our App’s, making use of the Wowza Media Services but the only issue was that they were only available on their iOS and Android native SDK’s. Well not anymore!🥳XamBoy and I got to work and now we have just pre-released a brand new Plugin and set of Xamarin Bindings for the community.
The setup process for the plugin is pretty simple and it’s well documented on the Wowza Client Plugin GitHub page. you can complete the Setup process following these steps:
- Install the
nugetpackage into your PCL project and Client projects.
- Create your Wowza Cloud Console Livestream.
- Follow the OBS Streaming Software setup guide.
- Follow the Getting Started guide.
You just have to use WowzaClient.Current
The Wowza Client Plugin renders its playback on a Native Custom View called WowzaPlayer on each platform, so to give support to it on Xamarin Forms we are simply going to create custom renderers and initialize our view correctly for each platform, let’s start by creating a custom Xamarin Forms View in our Controls Folder.
STEP 1: CREATE CUSTOM Xamarin forms control FOR OUR WOWZA PLAYER
Step 2: Create Custom Renderers for oUR Wowza Player
STEP 3: USE CUSTOM CONTROL
To add our WowzaPlayer to our page we first need to add the namespace where we can find our new component, in my case it’s under my controls directory so the namespace looks like this:
Once we have added the namespace correctly we can now use our WowzaPlayer in our Page normally like any other component.
Setup player and playback the livestream in viewmodel
STEP 1: Create config class
Before we can setup our player we will need to send it a config class that inherits from the IWowzaConfig interface containing the details of our previously created Wowza Cloud Console Live streaming session:
STEP 2: setup player
To tell our Wowza Client to setup our player and prepare for playing our livestream we simple need to call the Setup method and send our newly created config.
STEP 3: PLAY LIVESTREAM
Ce finito Guys!! 🥳Congrats, now you have everything ready to start the playback of the livestream in our Xamarin Forms App! Simply call the Play() method and you should now be able to see your livestream running smoothly!
Future Improvements for release:
- Enable Broadcasting from Mobile App
Official Wowza SDK Documentation:
Full documentation of the project:
Xamarin Forms sample project:
Made with ❤ by Pujols