private void OnDidConnect(object sender, EventArgs e)
        {
            lock (_locker)
            {
                if (Session == null || PublisherKit != null)
                {
                    return;
                }

                OTError error;
                PublisherKit = new OTPublisher(null, new OTPublisherSettings
                {
                    Name             = "XamarinOpenTok",
                    CameraFrameRate  = OTCameraCaptureFrameRate.OTCameraCaptureFrameRate15FPS,
                    CameraResolution = OTCameraCaptureResolution.High,
                });

                PublisherKit.PublishVideo   = IsVideoPublishingEnabled;
                PublisherKit.PublishAudio   = IsAudioPublishingEnabled;
                PublisherKit.StreamCreated += OnPublisherStreamCreated;

                Session.Publish(PublisherKit, out error);
                PublisherUpdated?.Invoke(this, EventArgs.Empty);
            }
        }
 private void OnSubscriberDidConnectToStream(object sender, EventArgs e)
 {
     lock (_locker)
     {
         if (SubscriberKit != null)
         {
             SubscriberUpdated?.Invoke();
             IsSubscriberVideoEnabled = SubscriberKit?.Stream?.HasVideo ?? false;
             PublisherUpdated?.Invoke();
         }
     }
 }
 private void OnSubscriberConnectionChanged(bool isConnected)
 {
     lock (_locker)
     {
         if (SubscriberKit != null)
         {
             SubscriberUpdated?.Invoke();
             IsSubscriberConnected    = isConnected;
             IsSubscriberVideoEnabled = SubscriberKit?.Stream?.HasVideo ?? false;
             PublisherUpdated?.Invoke();
         }
     }
 }
 private void OnSubscriberConnectionChanged(bool isConnected, OTSubscriber subscriberKit)
 {
     lock (_locker)
     {
         if (subscriberKit?.Stream != null)
         {
             if (Subscribers.ContainsKey(subscriberKit.Stream.StreamId))
             {
                 SubscriberUpdated?.Invoke(this, new OpenTokUserUpdatedEventArgs(subscriberKit.Stream.StreamId));
                 IsSubscriberConnected    = isConnected;
                 IsSubscriberVideoEnabled = subscriberKit.Stream?.HasVideo ?? false;
                 PublisherUpdated?.Invoke(this, new OpenTokUserUpdatedEventArgs(PublisherKit.Session.SessionId));
             }
         }
     }
 }
        private void OnDidConnect(object sender, EventArgs e)
        {
            lock (_locker)
            {
                if (Session == null ||
                    PublisherKit != null)
                {
                    return;
                }

                PublisherKit = new Publisher.Builder(CrossCurrentActivity.Current.AppContext).Build();
                PublisherKit.StreamCreated += OnPublisherStreamCreated;

                PublisherKit.SetStyle(BaseVideoRenderer.StyleVideoScale, BaseVideoRenderer.StyleVideoFill);
                PublisherKit.PublishAudio = IsAudioPublishingEnabled;
                PublisherKit.PublishVideo = IsVideoPublishingEnabled;
                PublisherUpdated?.Invoke();
                Session.Publish(PublisherKit);
                PublisherKit.PublishVideo = IsVideoPublishingEnabled;
            }
        }
Ejemplo n.º 6
0
 private PlatformOpenTokService RaisePublisherUpdated()
 {
     PublisherUpdated?.Invoke();
     return(this);
 }