Last active
August 9, 2017 13:58
-
-
Save ggoldens/cdbf8793fd071fcf9dd2777d6e1275d5 to your computer and use it in GitHub Desktop.
Xamarin and Vidyo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Android.App; | |
using Android.Widget; | |
using Android.OS; | |
using Com.Vidyo.VidyoClient.Connector; | |
namespace VideoChatDemo | |
{ | |
[Activity(Label = "VideoChatDemo", MainLauncher = true, Icon = "@mipmap/icon")] | |
public class MainActivity : Activity, VidyoConnector.IConnect | |
{ | |
VidyoConnector vc; | |
// Vidyo configuration | |
string host = "prod.vidyo.io"; | |
string token = ""; // Enter here your generated token | |
string resourceId = "demoRoom"; // Enter here your room name | |
string displayName = "MobileUser"; // Enter here your display name | |
protected override void OnCreate(Bundle savedInstanceState) | |
{ | |
base.OnCreate(savedInstanceState); | |
// Set our view from the "main" layout resource | |
SetContentView(Resource.Layout.Main); | |
Connector.SetApplicationUIContext(this); | |
Connector.Initialize(); | |
// Get our UI from the layout resource and attach an event to them | |
Button constructButton = FindViewById<Button>(Resource.Id.constructButton); | |
Button connectButton = FindViewById<Button>(Resource.Id.connectButton); | |
Button disconnectButton = FindViewById<Button>(Resource.Id.disconnectButton); | |
FrameLayout videoFrame = FindViewById<FrameLayout>(Resource.Id.videoFrame); | |
constructButton.Click += delegate | |
{ | |
vc = new VidyoConnector(videoFrame, VidyoConnector.VidyoConnectorViewStyle.VIDYOCONNECTORVIEWSTYLEDefault, 16, "", "", 0); | |
vc.ShowViewAt(videoFrame, 0, 0, videoFrame.Width, videoFrame.Height); | |
}; | |
connectButton.Click += delegate | |
{ | |
vc.Connect(host, token, displayName, resourceId, this); | |
}; | |
disconnectButton.Click += delegate | |
{ | |
vc.Disconnect(); | |
}; | |
} | |
// IConnect callbacks | |
public void OnDisconnected(VidyoConnector.VidyoConnectorDisconnectReason p0) { } | |
public void OnFailure(VidyoConnector.VidyoConnectorFailReason p0) { } | |
public void OnSuccess() { } | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment