DT.Xamarin.AntMedia.WebRTC.Forms
1.2.2
dotnet add package DT.Xamarin.AntMedia.WebRTC.Forms --version 1.2.2
NuGet\Install-Package DT.Xamarin.AntMedia.WebRTC.Forms -Version 1.2.2
<PackageReference Include="DT.Xamarin.AntMedia.WebRTC.Forms" Version="1.2.2" />
paket add DT.Xamarin.AntMedia.WebRTC.Forms --version 1.2.2
#r "nuget: DT.Xamarin.AntMedia.WebRTC.Forms, 1.2.2"
// Install DT.Xamarin.AntMedia.WebRTC.Forms as a Cake Addin #addin nuget:?package=DT.Xamarin.AntMedia.WebRTC.Forms&version=1.2.2 // Install DT.Xamarin.AntMedia.WebRTC.Forms as a Cake Tool #tool nuget:?package=DT.Xamarin.AntMedia.WebRTC.Forms&version=1.2.2
CRITICAL thing about SDK It Does Not Support Any Simulator build for now
Xamarin Forms WebRTC Sample app
Step by Step Tutorial how to add AntMedia WebRTC to Forms app
Prerequisites
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
add
AntManagerIos.Init();
to AppDelegate.cspublic override bool FinishedLaunching(UIApplication app, NSDictionary options) { AntManagerIos.Init(); global::Xamarin.Forms.Forms.Init(); LoadApplication(new App()); return base.FinishedLaunching(app, options); } ...
Configure Android Intent for Nuget Open Android/MainActivity.cs Add code to OnCreate
using DT.Xamarin.AntMedia.WebRTC.Forms.Android;
protected override void OnCreate(Bundle savedInstanceState)
{
...
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());
}
- add android and ios permissions usage
Modify Properties/AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.dreamteammobile.antmedia.dt_antmedia_tutorial_forms">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<application android:label="DT.AntMedia.Tutorial.Forms.Android" android:theme="@style/MainTheme"></application>
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>
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>
add reference to framework on page or some view in Core project
xmlns:ant="clr-namespace:DT.Xamarin.AntMedia.WebRTC.Forms;assembly=DT.Xamarin.AntMedia.WebRTC.Forms"
and 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
for more control on view, change InitMode property
<ant:AntWebRTCView x:Name="AntFrame" Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="1" RenderingMode="ScaleAspectFit" WebRTCMode="Publish" Camera="Front" ShowDebugLogs="True" InitMode="InitOnViewRender" PlayStarted="AntFrame_Refresh" PlayFinished="AntFrame_Refresh" PublishStarted="AntFrame_Refresh" PublishFinished="AntFrame_Refresh" Error="AntFrame_Error" />
set server address and token(token can be empty string)
AntManager.Current.DefaultServer = InitialData.SERVER_URL; AntManager.Current.DefaultToken = InitialData.Token;
to Start or Stop stream call where you need
void SomeActionButton_Clicked(System.Object sender, System.EventArgs e) { if (AntFrame.IsPublishing || AntFrame.IsPlaying) { AntFrame.Stop(); DelayedRestart();//if publishing that will make rendering from camera to layout as preview } else { AntFrame.Start(); } }
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
Start from DT.Xamarin.AntMedia.Samples.sln
replace constant to your server addres in DT.Configuration/InitialData.cs
public const string SERVER_ADDRESS = "domain-name.com:5080";
- Set Froms.Android or Forms.iOS project as Startup Project, click Run button in Visual Studio.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid is compatible. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios is compatible. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Xamarin.Forms (>= 4.6.0.1180)
-
MonoAndroid 0.0
- DT.Xamarin.AntMedia.WebRTC.Android (>= 1.2.2)
- Xamarin.Forms (>= 4.6.0.1180)
-
Xamarin.iOS 0.0
- DT.Xamarin.AntMedia.WebRTC.iOS (>= 1.2.2)
- Xamarin.Forms (>= 4.6.0.1180)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.2 | 4,786 | 1/18/2021 |
1.2.1 | 368 | 1/18/2021 |
1.1.0 | 459 | 12/3/2020 |
1.0.9 | 426 | 12/3/2020 |
1.0.8 | 420 | 12/3/2020 |
1.0.7 | 394 | 12/3/2020 |
1.0.6 | 555 | 11/8/2020 |
1.0.3 | 439 | 11/3/2020 |
1.0.2 | 446 | 11/3/2020 |
1.0.1 | 457 | 11/3/2020 |
1.0.0 | 493 | 11/3/2020 |
0.9.9 | 511 | 10/30/2020 |
0.9.8 | 437 | 10/30/2020 |
0.9.7 | 462 | 10/21/2020 |
0.9.6 | 484 | 10/21/2020 |
0.9.5 | 456 | 10/20/2020 |
0.9.4 | 479 | 10/20/2020 |
0.9.3 | 514 | 10/20/2020 |
0.9.2 | 533 | 10/19/2020 |
0.9.1 | 465 | 10/19/2020 |
0.9.0 | 469 | 10/19/2020 |
Custom Forms SDK based on native bindings of Ant Media Free WebRTC SDKs made by DreamTeam-Mobile
for Documentation, how to use this SDK, Tutorial and Xamarin samples go to https://github.com/DreamTeamMobile/Xamarin.AntMedia.Samples
native versions:
WebRTCAndroidFramework_29_July_2020-sf0vyq
WebRTCiOSReferenceProject_10_Aug_2020-o0odv5