private void QuitApplication() { var dlgRes = MessageBox.Show("Are you sure you want to close VidyoConnector?", "Exit", MessageBoxButton.YesNo, MessageBoxImage.Question); if (dlgRes == MessageBoxResult.Yes) { Log.Info("Exiting the app... "); if (ConnectionState == ConnectionState.Connected) { LeaveCall(); } // Unregistering to events we want to handle. _connector.UnregisterLocalCameraEventListener(); _connector.UnregisterLocalWindowShareEventListener(); _connector.UnregisterLocalMicrophoneEventListener(); _connector.UnregisterLocalSpeakerEventListener(); _connector.UnregisterParticipantEventListener(); _connector.UnregisterLocalMonitorEventListener(); _connector.Disable(); _connector = null; Log.Info("VidyoConnector disabled."); ConnectorPKG.Uninitialize(); Log.Info("VidyoConnector unitialized."); System.Windows.Application.Current.Shutdown(); } }
public string OnAppStart() { string clientVersion = "Failed"; #if __ANDROID__ ConnectorPKG.SetApplicationUIContext(Forms.Context as Activity); #endif // Initialize VidyoClient library. // This should be called only once throughout the lifetime of the app. _vidyoClientInitialized = ConnectorPKG.Initialize(); if (_vidyoClientInitialized) { try { _connector = new Connector(_videoView.Handle, Connector.ConnectorViewStyle.ConnectorviewstyleDefault, 15, "info@VidyoClient info@VidyoConnector warning", "", 0); // Get the version of VidyoClient clientVersion = _connector.GetVersion(); // If enableDebug is configured then enable debugging if (_enableDebug) { _connector.EnableDebug(7776, "warning info@VidyoClient info@VidyoConnector"); } // Set experimental options if any exist if (_experimentalOptions != null) { ConnectorPKG.SetExperimentalOptions(_experimentalOptions); } // Set initial position RefreshUI(); _connector.RegisterLocalCameraEventListener(this); // Register for log callbacks if (!_connector.RegisterLogEventListener(this, "info@VidyoClient info@VidyoConnector warning")) { _logger.Log("VidyoConnector RegisterLogEventListener failed"); } } catch (Exception e) { _logger.Log("VidyoConnector Construction failed"); _logger.Log(e.Message); } } else { _logger.Log("ERROR: VidyoClientInitialize failed - not constructing VidyoConnector ..."); } return(clientVersion); }
public void Cleanup() { _connector.Disable(); _connector = null; // Uninitialize VidyoClient library. // This should be called only once throughout the lifetime of the app. ConnectorPKG.Uninitialize(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Set application context and initialize VidyoClient library ConnectorPKG.SetApplicationUIContext(this); ConnectorPKG.Initialize(); videoFrame = FindViewById <FrameLayout>(Resource.Id.videoFrame); try { // Construct VidyoConnector vc = new Connector(videoFrame.Handle, Connector.ConnectorViewStyle.ConnectorviewstyleDefault, 15, "warning info@VidyoConnector info@VidyoClient", "", 0); // Register for local and remote camera event listeners if (!vc.RegisterLocalCameraEventListener(this)) { Console.WriteLine("RegisterLocalCameraEventListener failed"); } if (!vc.RegisterRemoteCameraEventListener(this)) { Console.WriteLine("RegisterRemoteCameraEventListener failed"); } // Get our buttons from the layout resource and attach an event to each button Button showPreviewButton = FindViewById <Button>(Resource.Id.showPreviewButton); Button connectButton = FindViewById <Button>(Resource.Id.connectButton); Button disconnectButton = FindViewById <Button>(Resource.Id.disconnectButton); Button cycleCameraButton = FindViewById <Button>(Resource.Id.cycleCameraButton); // Delegates when the buttons are clicked showPreviewButton.Click += delegate { vc.ShowViewAt(videoFrame.Handle, 0, 0, (uint)videoFrame.Width, (uint)videoFrame.Height); }; connectButton.Click += delegate { string token = ""; //INSERT VALID TOKEN vc.Connect("prod.vidyo.io", token, "Xamarin.Android User", "demoroom", this); }; disconnectButton.Click += delegate { vc.Disconnect(); }; cycleCameraButton.Click += delegate { vc.CycleCamera(); }; } catch (Exception e) { Console.WriteLine(e); } }
public void Initialize(IntPtr viewId, uint width, uint height) { ConnectorPKG.Initialize(); c = new Connector(viewId, Connector.ConnectorViewStyle.ConnectorviewstyleDefault, 15, "", "", 0); c.ShowViewAt(viewId, 0, 0, width, height); c.SetMicrophonePrivacy(false); c.SetSpeakerPrivacy(false); c.SelectDefaultCamera(); c.SelectDefaultMicrophone(); c.SelectDefaultSpeaker(); }
// The app is terminating void AppWillTerminate(Foundation.NSNotification notification) { Console.WriteLine("Received a notification UIApplication: " + notification); // Deregister from any/all notifications. Foundation.NSNotificationCenter.DefaultCenter.RemoveObserver(this); // Set the VidyoConnector to nil so it is garbage collected vc = null; // Uninitialize VidyoClient library. // This should be called only once throughout the lifetime of the app. ConnectorPKG.Uninitialize(); }
/// <summary> /// Entry point. Prepares and launches Vidyo functionality. /// </summary> /// <param name="handle">Control's handler where video will be rendered.</param> /// <param name="width">Width of video area.</param> /// <param name="height">Height of video area.</param> public void Init(IntPtr handle1, IntPtr handle2, IntPtr handle3, IntPtr handle4, IntPtr handle5, IntPtr localHandle) { ConnectorPKG.Initialize(); DisplayName = "DemoUser"; Portal = "https://vidyocloud.com"; _sortedHandles.Add(1, handle1); _sortedHandles.Add(2, handle2); _sortedHandles.Add(3, handle3); _sortedHandles.Add(4, handle4); _sortedHandles.Add(5, handle5); Log.Info("VidyoConnector initialized."); _localHandle = localHandle; _connector = new Connector(IntPtr.Zero, Connector.ConnectorViewStyle.ConnectorviewstyleDefault, 8, "all@VidyoClient all@LmiCsEpClient", "VidyoClient.log", 0); // This should be called on each window resizing. // Adding Null's to devices collection, which is 'None' in GUI. Selecting 'None' means no device will be used. LocalCameras.Add(new LocalCameraModel(null)); LocalMicrophones.Add(new LocalMicrophoneModel(null)); LocalSpeakers.Add(new LocalSpeakerModel(null)); // Registering to events we want to handle. _connector.RegisterLocalCameraEventListener(new LocalCameraListener(this)); _connector.RegisterLocalWindowShareEventListener(new LocalWindowShareListener(this)); _connector.RegisterLocalMicrophoneEventListener(new LocalMicropfoneListener(this)); _connector.RegisterLocalSpeakerEventListener(new LocalSpeakerListener(this)); _connector.RegisterParticipantEventListener(new ParticipantListener(this)); _connector.RegisterLocalMonitorEventListener(new LocalMonitorListener(this)); _connector.RegisterRemoteCameraEventListener(new RemoteCameraListener(this)); _connector.RegisterMessageEventListener(new MessageListener(this)); // We are not in call when application started. ConnectionState = ConnectionState.NotConnected; // On application start Vidyo turns on default camera. IsCameraOn = true; // On application start Vidyo turns on default microphone. IsMicrophoneOn = true; EnableDebug = false; ParseCommandLineArgs(); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view. // Authorize this app to use the microphone and camera AuthorizeMediaUse(); // Initialize VidyoClient library. // This should be called only once throughout the lifetime of the app. bool status = ConnectorPKG.Initialize(); Console.WriteLine("VidyoClientInitalize status = " + status); try { // Construct VidyoConnector vc = new Connector(videoView.Handle, Connector.ConnectorViewStyle.ConnectorviewstyleDefault, 15, "warning info@VidyoConnector info@VidyoClient", "", 0); // Register for local and remote camera event listeners if (!vc.RegisterLocalCameraEventListener(this)) { Console.WriteLine("RegisterLocalCameraEventListener failed"); } if (!vc.RegisterRemoteCameraEventListener(this)) { Console.WriteLine("RegisterRemoteCameraEventListener failed"); } } catch (Exception e) { Console.WriteLine(e); } // Register for OS notifications about this app running in background/foreground, etc. Foundation.NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.DidEnterBackgroundNotification, AppDidEnterBackground); Foundation.NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.WillEnterForegroundNotification, AppWillEnterForeground); Foundation.NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.WillTerminateNotification, AppWillTerminate); }
/// <summary> /// Entry point. Prepares and launches Vidyo functionality. /// </summary> /// <param name="handle">Control's handler where video will be rendered.</param> /// <param name="width">Width of video area.</param> /// <param name="height">Height of video area.</param> public void Init(IntPtr handle, uint width, uint height) { ConnectorPKG.Initialize(); Log.Info("VidyoConnector initialized."); _connector = new Connector(handle, Connector.ConnectorViewStyle.ConnectorviewstyleDefault, 8, "all@VidyoClient", "VidyoClient.log", 0); // This should be called on each window resizing. _connector.ShowViewAtPoints(handle, 0, 0, width, height); Log.Info(string.Format("Showing view with width={0} and height={1}", width, height)); // Adding Null's to devices collection, which is 'None' in GUI. Selecting 'None' means no device will be used. LocalCameras.Add(new LocalCameraModel(null)); LocalMicrophones.Add(new LocalMicrophoneModel(null)); LocalSpeakers.Add(new LocalSpeakerModel(null)); // Registering to events we want to handle. _connector.RegisterLocalCameraEventListener(new LocalCameraListener(this)); _connector.RegisterLocalWindowShareEventListener(new LocalWindowShareListener(this)); _connector.RegisterLocalMicrophoneEventListener(new LocalMicropfoneListener(this)); _connector.RegisterLocalSpeakerEventListener(new LocalSpeakerListener(this)); _connector.RegisterParticipantEventListener(new ParticipantListener(this)); _connector.RegisterLocalMonitorEventListener(new LocalMonitorListener(this)); //_connector.RegisterLogEventListener(new LogListener(this), "*@VidyoClient"); _connector.RegisterMessageEventListener(new MessageListener(this)); // We are not in call when application started. ConnectionState = ConnectionState.NotConnected; // On application start Vidyo turns on default camera. IsCameraOn = true; // On application start Vidyo turns on default microphone. IsMicrophoneOn = true; EnableDebug = false; ParseCommandLineArgs(); }
public void Cleanup() { _connector.Disable(); ConnectorPKG.Uninitialize(); }
// The app is terminating protected override void OnDestroy() { vc.Disable(); ConnectorPKG.Uninitialize(); base.OnDestroy(); }