Skip to content

Latest commit

 

History

History

DT.WebRTC.Forms.Android

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Xamarin Forms WebRTC Sample app, Android project

you need up running Ant Media Server, detailed explanation here

How to use nuget

       protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);
 //Begin Inserted
            AntManagerDroid.Init(Intent);
//End Inserted

            global::Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());
        }
  • 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.Android as Startup project, click Run button in Visual Studio.