Skip to content

Latest commit

 

History

History

DT.WebRTC.Forms.iOS

Xamarin Forms WebRTC Sample app, iOS project

you need up running Ant Media Server, detailed explanation here

How to use nuget

  • to project Core - add nuget package DT.Xamarin.AntMedia.WebRTC.Forms NuGet Package

  • add AntManagerIos.Init(); to AppDelegate.cs

      public override bool FinishedLaunching(UIApplication app, NSDictionary options)
          {
              AntManagerIos.Init();
              global::Xamarin.Forms.Forms.Init();
              LoadApplication(new App());
              return base.FinishedLaunching(app, options);
          }
    ...
    
  • add Camera and Microphone Permissions usage description to Info.plist

        <key>NSCameraUsageDescription</key>
        <string>Camera access is required for video chat</string>
        <key>NSMicrophoneUsageDescription</key>
        <string>Microphone access is required for video chat</string>
    
  • use special control AntWebRTCView

    <?xml version="1.0" encoding="utf-8"?>
    <ContentPage
      xmlns="http://xamarin.com/schemas/2014/forms"
      xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
      xmlns:ant="clr-namespace:DT.Xamarin.AntMedia.WebRTC.Forms;assembly=DT.Xamarin.AntMedia.WebRTC.Forms"
      x:Class="DT.AntMedia.Tutorial.Forms.MainPage">
      <Grid>
          <Grid.RowDefinitions>
              <RowDefinition/>
              <RowDefinition/>
          </Grid.RowDefinitions>
          <ant:AntWebRTCView
              x:Name="AntFrame1"
              Grid.Row="0"
              Server="ws://drmtm.us:5080/WebRTCAppEE/websocket"
              RenderingMode="ScaleAspectFit"
              WebRTCMode="Publish"
              Camera="Front"
              StreamID="stream1"
              ShowDebugLogs="True"
              InitMode="InitAndStartOnViewRender"
              />
    
          <ant:AntWebRTCView
              x:Name="AntFrame2"
              Grid.Row="1"
              Server="ws://drmtm.us:5080/WebRTCAppEE/websocket"
              RenderingMode="ScaleAspectFit"
              WebRTCMode="Play"
              StreamID="stream2"
              ShowDebugLogs="True"
              InitMode="InitAndStartOnViewRender"
              />
      </Grid>
    </ContentPage>
    

    You done! run and check

  • then you can use our Documentation for detailed description on controls

  • or simple Tutorial

What available in our sample

Simple copy of AntMedia sample app with all basic video call functions:

  • Start/Stop Publishing WebRTC stream
  • Start/Stop Playing WebRTC stream
  • Init to preview from camera before start publishing
  • Mute audio
  • Mute video
  • Switch camera

How to Run Sample

  1. Start from DT.Xamarin.AntMedia.Samples.sln

  2. replace constant to your server addres in DT.Configuration/InitialData.cs

public const string SERVER_ADDRESS = "domain-name.com:5080";
  1. Set Forms.iOS as Startup project, click Run button in Visual Studio.