Skip to content

Xamarin iOS WebRTC Tutorial

Sergey Bokatuk edited this page Oct 22, 2020 · 2 revisions

To start any work with Ant Media Mobile SDKs you need AntMedia Server in web, how to setup that server described in Ant Media Documentation

if you have server on some domain address we recommend valid ssl certificate on domain to start work

domain-name.com:5080

Creating iOS Project

Open Visual Studio and Create a New iOS Project

Just Click New > In Section App under iOS > Single View App . Create iOS App

Click Next button and Fill App Name as below. Fill Name

Click Next and Choose if you need something in the next window, usually leave as is Configure

Click Create and finish creating the project.

Add iOS WebRTC SDK Nuget package

After creating the project. Let's add necessary Nuget package to the project.

Add nuget package DT.Xamarin.AntMedia.WebRTC.iOS NuGet Package to DT.AntMedia.WebRTC.iOS For doing that click right button on DT.AntMedia.WebRTC.iOS at Solution and Choose Manage Nuget Packages...

add DT.Xamarin.AntMedia.WebRTC.iOS to DT.AntMedia.WebRTC.iOS

In Opened window at right top paste DT.Xamarin.AntMedia.WebRTC.iOS and click enter, you will find correct package, then check package at the right and click Add Package add DT.Xamarin.AntMedia.WebRTC.iOS to DT.AntMedia.WebRTC.iOS

Add iOS permissions

	<key>NSCameraUsageDescription</key>
	<string>Camera access is required for video chat</string>
	<key>NSMicrophoneUsageDescription</key>
	<string>Microphone access is required for video chat</string>

add Camera and Microphone Permissions usage description to Info.plist

iOS permissions

Next chapters will be added later, completed tutorial source code available right now here DT.WebRTC.iOS

Build and Start the App

App directly publishes stream to the server before that we need to let the app has the permissions for that. Make sure that you let the app has permissions.

Then restart the app and it should open the camera and start streaming. You should see stream id on the screen as below. You can go to the http://SERVER_URL:5080/WebRTCAppEE/player.html, write stream id to the text box and click Play button.

then you can add Mute buttons, Switch camera, Play/Stop and so on, reference to such usage you can find in iOS Sample app