Exemple #1
0
 public override void onStreamDestroyed(PublisherKit publisher, Stream stream)
 {
     if (OpenTokConfig.SUBSCRIBE_TO_SELF && mSubscriber != null)
     {
         unsubscriberFromStream(stream);
     }
 }
 public override void onStreamDestroyed(PublisherKit publisher, Stream stream)
 {
     if ((com.opentok.android.demo.config.OpenTokConfig.SUBSCRIBE_TO_SELF && mSubscriber != null))
     {
         unsubscribeFromStream(stream);
     }
 }
Exemple #3
0
        private void OnConnected(object sender, Session.ConnectedEventArgs e)
        {
            if (Session == null)
            {
                return;
            }

            ClearPublisher();

            using (var builder = new Publisher.Builder(CrossCurrentActivity.Current.AppContext)
                                 .Resolution(Publisher.CameraCaptureResolution.High)
                                 .VideoTrack(Permissions.HasFlag(OpenTokPermission.Camera))
                                 .AudioTrack(Permissions.HasFlag(OpenTokPermission.RecordAudio))
                                 .Name("XamarinOpenTok"))
            {
                PublisherKit = builder.Build();
                PublisherKit.PublishVideo = IsVideoPublishingEnabled;
                PublisherKit.PublishAudio = IsAudioPublishingEnabled;
                PublisherKit.SetStyle(BaseVideoRenderer.StyleVideoScale, BaseVideoRenderer.StyleVideoFill);
                PublisherKit.StreamCreated       += OnPublisherStreamCreated;
                PublisherKit.AudioFallbackEnabled = PublisherVideoType == OpenTokPublisherVideoType.Camera;
                PublisherKit.PublisherVideoType   = PublisherVideoType == OpenTokPublisherVideoType.Camera
                    ? PublisherKit.PublisherKitVideoType.PublisherKitVideoTypeCamera
                    : PublisherKit.PublisherKitVideoType.PublisherKitVideoTypeScreen;
                Session.Publish(PublisherKit);
                RaisePublisherUpdated();
            }
        }
 public void OnStreamCreated(PublisherKit publisher, Stream stream)
 {
     mStreams.Add(stream);
     if (mSubscriber == null) {
         SubscribeToStream(stream);
     }
 }
Exemple #5
0
 public void OnStreamDestroyed(PublisherKit p0, Com.Opentok.Android.Stream p1)
 {
     if ((this._subscriber != null))
     {
         UnsubscribeFromStream(p1);
     }
 }
Exemple #6
0
 public void OnStreamCreated(PublisherKit p0, Stream p1)
 {
     _streams.Add (p1);
     if (_subscriber == null) {
         SubscribeToStream (p1);
     }
 }
 public void OnStreamDestroyed(PublisherKit p0, Stream p1)
 {
     if (_subscriber != null)
     {
         UnsubscribeFromStream(p1);
     }
 }
        public override void EndSession(bool sendBackToRoot, bool showEvaluateCall)
        {
            try
            {
                if (Session == null && SubscriberKit == null && PublisherKit == null)
                {
                    return;
                }

                lock (_locker)
                {
                    if (SubscriberKit != null)
                    {
                        SubscriberKit.SubscribeToAudio        = false;
                        SubscriberKit.SubscribeToVideo        = false;
                        SubscriberKit.Connected              -= OnSubscriberConnected;
                        SubscriberKit.StreamDisconnected     -= OnSubscriberDisconnected;
                        SubscriberKit.SubscriberDisconnected -= OnSubscriberDisconnected;
                        SubscriberKit.VideoDisabled          -= OnSubscriberVideoDisabled;
                        SubscriberKit.VideoEnabled           -= OnSubscriberVideoEnabled;
                        SubscriberKit.Dispose();
                        SubscriberKit = null;
                    }

                    if (PublisherKit != null)
                    {
                        PublisherKit.PublishAudio   = false;
                        PublisherKit.PublishVideo   = false;
                        PublisherKit.StreamCreated -= OnPublisherStreamCreated;
                        PublisherKit.Dispose();
                        PublisherKit = null;
                    }

                    if (Session != null)
                    {
                        Session.ConnectionDestroyed -= OnConnectionDestroyed;
                        Session.Connected           -= OnDidConnect;
                        Session.StreamReceived      -= OnStreamCreated;
                        Session.StreamDropped       -= OnStreamDestroyed;
                        Session.Error  -= OnError;
                        Session.Signal -= OnSignal;
                        Session.Disconnect();
                        Session.Dispose();
                        Session = null;
                    }
                }

                ClearPublisherUpdated();
                ClearSubscribeUpdated();
                _medicalVideoCall.VideoCallStatusAsync((int)CallStatus.Ending, null, sendBackToRoot, showEvaluateCall);
            }
            finally
            {
                InvitedConnection = null;
                _medicalVideoCall.Messages.Clear();
                IsSessionStarted    = false;
                IsPublishingStarted = false;
            }
        }
Exemple #9
0
 public void OnStreamCreated(PublisherKit publisher, Stream stream)
 {
     mStreams.Add(stream);
     if (mSubscriber == null)
     {
         SubscribeToStream(stream);
     }
 }
 public override void onStreamDestroyed(PublisherKit publisher, Stream stream)
 {
     if ((OpenTokConfig.SUBSCRIBE_TO_SELF && mSubscriber != null))
     {
         unsubscribeFromStream(stream);
         screenshotWidget.Visibility = View.GONE;
     }
 }
Exemple #11
0
 public void OnStreamCreated(PublisherKit p0, Com.Opentok.Android.Stream p1)
 {
     this._streams.Add(p1);
     //if (this._subscriber == null)
     //{
     //    SubscribeToStream(p1);
     //}
 }
        public void OnConnected(Session p0)
        {
            mPublisher = new Publisher.Builder(this).Build();
            mPublisher.SetPublisherListener(this);

            mPublisherViewContainer.AddView(mPublisher.View);
            mSession.Publish(mPublisher);
        }
 public void OnStreamCreated(PublisherKit p0, Stream p1)
 {
     _streams.Add(p1);
     if (_subscriber == null)
     {
         SubscribeToStream(p1);
     }
 }
        public override void EndSession()
        {
            try
            {
                if (Session == null)
                {
                    return;
                }

                lock (_locker)
                {
                    if (Subscribers?.Count > 0)
                    {
                        foreach (OTSubscriber subscriberKit in Subscribers.Select(subscriber => subscriber.Value))
                        {
                            subscriberKit.SubscribeToAudio         = false;
                            subscriberKit.SubscribeToVideo         = false;
                            subscriberKit.DidConnectToStream      -= OnSubscriberConnected;
                            subscriberKit.DidDisconnectFromStream -= OnSubscriberDisconnected;
                            subscriberKit.VideoDataReceived       -= OnSubscriberVideoDataReceived;
                            subscriberKit.VideoEnabled            -= OnSubscriberVideoEnabled;
                            subscriberKit.VideoDisabled           -= OnSubscriberVideoDisabled;
                            subscriberKit.Dispose();
                        }

                        Subscribers = new Dictionary <string, OTSubscriber>();
                    }

                    if (PublisherKit != null)
                    {
                        PublisherKit.PublishAudio   = false;
                        PublisherKit.PublishVideo   = false;
                        PublisherKit.StreamCreated -= OnPublisherStreamCreated;
                        PublisherKit.Dispose();
                        PublisherKit = null;
                    }

                    if (Session != null)
                    {
                        Session.ConnectionDestroyed -= OnConnectionDestroyed;
                        Session.DidConnect          -= OnDidConnect;
                        Session.StreamCreated       -= OnStreamCreated;
                        Session.StreamDestroyed     -= OnStreamDestroyed;
                        Session.DidFailWithError    -= OnError;
                        Session.ReceivedSignalType  -= OnSignalReceived;
                        Session.Disconnect();
                        Session.Dispose();
                        Session = null;
                    }
                }
            }
            finally
            {
                IsSessionStarted    = false;
                IsPublishingStarted = false;
            }
        }
Exemple #15
0
 public override void onStreamCreated(PublisherKit publisher, Stream stream)
 {
     if (OpenTokConfig.SUBSCRIBE_TO_SELF)
     {
         mStreams.Add(stream);
         if (mSubscriber == null)
         {
             subscribeToStream(stream);
         }
     }
 }
Exemple #16
0
        public override void EndSession()
        {
            lock (_sessionLocker)
            {
                try
                {
                    if (Session == null)
                    {
                        return;
                    }

                    foreach (var subscriberKit in _subscribers)
                    {
                        ClearSubscriber(subscriberKit);
                    }
                    _subscribers.Clear();
                    _subscriberStreamIds.Clear();

                    if (PublisherKit != null)
                    {
                        using (PublisherKit)
                        {
                            PublisherKit.PublishAudio   = false;
                            PublisherKit.PublishVideo   = false;
                            PublisherKit.StreamCreated -= OnPublisherStreamCreated;
                        }
                        PublisherKit = null;
                    }

                    RaisePublisherUpdated().
                    RaiseSubscriberUpdated();

                    if (Session != null)
                    {
                        using (Session)
                        {
                            Session.ConnectionDestroyed -= OnConnectionDestroyed;
                            Session.Connected           -= OnConnected;
                            Session.StreamReceived      -= OnStreamReceived;
                            Session.StreamDropped       -= OnStreamDropped;
                            Session.Error  -= OnError;
                            Session.Signal -= OnSignal;
                            Session.Disconnect();
                        }
                        Session = null;
                    }
                }
                finally
                {
                    IsSessionStarted    = false;
                    IsPublishingStarted = false;
                }
            }
        }
        public override void EndSession()
        {
            try
            {
                if (Session == null)
                {
                    return;
                }

                lock (_locker)
                {
                    if (SubscriberKit != null)
                    {
                        SubscriberKit.SubscribeToAudio    = false;
                        SubscriberKit.SubscribeToVideo    = false;
                        SubscriberKit.DidConnectToStream -= OnSubscriberDidConnectToStream;
                        SubscriberKit.VideoDataReceived  -= OnSubscriberVideoDataReceived;
                        SubscriberKit.VideoEnabled       -= OnSubscriberVideoEnabled;
                        SubscriberKit.VideoDisabled      -= OnSubscriberVideoDisabled;
                        SubscriberKit.Dispose();
                        SubscriberKit = null;
                    }

                    if (PublisherKit != null)
                    {
                        PublisherKit.PublishAudio   = false;
                        PublisherKit.PublishVideo   = false;
                        PublisherKit.StreamCreated -= OnPublisherStreamCreated;
                        PublisherKit.Dispose();
                        PublisherKit = null;
                    }

                    if (Session != null)
                    {
                        Session.ConnectionDestroyed -= OnConnectionDestroyed;
                        Session.DidConnect          -= OnDidConnect;
                        Session.StreamCreated       -= OnStreamCreated;
                        Session.StreamDestroyed     -= OnStreamDestroyed;
                        Session.DidFailWithError    -= OnError;
                        Session.ReceivedSignalType  -= OnSignalReceived;
                        Session.Disconnect();
                        Session.Dispose();
                        Session = null;
                    }
                }
            }
            finally
            {
                IsSessionStarted    = false;
                IsPublishingStarted = false;
            }
        }
Exemple #18
0
 public override void onStreamCreated(PublisherKit publisher, Stream stream)
 {
     if (OpenTokConfig.SUBSCRIBE_TO_SELF)
     {
         mStreams.Add(stream);
         if (mSubscriber == null)
         {
             subscribeToStream(stream);
         }
     }
     mPublisherFragment.showPublisherWidget(true);
     mPublisherFragment.initPublisherUI();
     mPublisherStatusFragment.showPubStatusWidget(true);
     mPublisherStatusFragment.initPubStatusUI();
 }
Exemple #19
0
        private void ClearPublisher()
        {
            if (PublisherKit == null)
            {
                return;
            }

            using (PublisherKit)
            {
                PublisherKit.PublishAudio   = false;
                PublisherKit.PublishVideo   = false;
                PublisherKit.StreamCreated -= OnPublisherStreamCreated;
                Session.Unpublish(PublisherKit);
            }
            PublisherKit = null;
        }
Exemple #20
0
        private void OnConnected(object sender, Session.ConnectedEventArgs e)
        {
            if (Session == null || PublisherKit != null)
            {
                return;
            }

            using (var builder = new Publisher.Builder(CrossCurrentActivity.Current.AppContext).Name("XamarinOpenTok"))
            {
                PublisherKit = builder.Build();
                PublisherKit.PublishVideo = IsVideoPublishingEnabled;
                PublisherKit.PublishAudio = IsAudioPublishingEnabled;
                PublisherKit.SetStyle(BaseVideoRenderer.StyleVideoScale, BaseVideoRenderer.StyleVideoFill);
                PublisherKit.StreamCreated += OnPublisherStreamCreated;

                Session.Publish(PublisherKit);
                RaisePublisherUpdated();
            }
        }
 public void OnStreamDestroyed(PublisherKit publisher, Stream stream)
 {
     UnsubscribeFromStream (stream);
 }
Exemple #22
0
 public void OnStreamDestroyed(PublisherKit p0, Stream p1)
 {
     if ((_subscriber != null)) {
         UnsubscribeFromStream (p1);
     }
 }
 public void OnError(PublisherKit publisher, OpentokError exception)
 {
     // error
 }
			public override void onAudioLevelUpdated(PublisherKit publisher, float audioLevel)
			{
				meterView.MeterValue = audioLevel;
			}
Exemple #25
0
 public void OnError(PublisherKit p0, OpentokError p1)
 {
 }
		public override void onError(PublisherKit publisher, OpentokError exception)
		{
			Log.i(LOGTAG, "Publisher exception: " + exception.Message);
		}
Exemple #27
0
 public override void onError(PublisherKit publisher, OpentokError exception)
 {
     Log.i(LOGTAG, "Publisher exception: " + exception.Message);
 }
 public void OnError(PublisherKit publisher, OpentokError exception)
 {
     // TODO: handle error
 }
Exemple #29
0
 public void OnError(PublisherKit publisher, OpentokError exception)
 {
     // error
 }
 private void SetVideoScaleStyle(PublisherKit publisherKit)
 => publisherKit.SetStyle(BaseVideoRenderer.StyleVideoScale, MapVideoScaleStyle(PublisherVideoScaleStyle));
Exemple #31
0
 public void OnError(PublisherKit p0, OpentokError p1)
 {
     //throw new NotImplementedException();
 }
		public override void onStreamCreated(PublisherKit publisher, Stream stream)
		{
			if (OpenTokConfig.SUBSCRIBE_TO_SELF)
			{
				mStreams.Add(stream);
				if (mSubscriber == null)
				{
					subscribeToStream(stream);
				}
			}
		}
		public override void onStreamDestroyed(PublisherKit publisher, Stream stream)
		{
			if ((OpenTokConfig.SUBSCRIBE_TO_SELF && mSubscriber != null))
			{
				unsubscribeFromStream(stream);
			}
		}
Exemple #34
0
 public override void onAudioLevelUpdated(PublisherKit publisher, float audioLevel)
 {
     meterView.MeterValue = audioLevel;
 }
 public void OnError(PublisherKit p0, OpentokError p1)
 {
 }
		public override void onStreamDestroyed(PublisherKit publisher, Stream stream)
		{
			if ((OpenTokConfig.SUBSCRIBE_TO_SELF && mSubscriber != null))
			{
				unsubscribeFromStream(stream);
				screenshotWidget.Visibility = View.GONE;
			}
		}
 public void OnError(PublisherKit publisher, OpentokError exception)
 {
     // TODO: handle error
 }
		public override void onStreamCreated(PublisherKit publisher, Stream stream)
		{

			if (OpenTokConfig.SUBSCRIBE_TO_SELF)
			{
				mStreams.Add(stream);
				if (mSubscriber == null)
				{
					subscribeToStream(stream);
				}
			}
			mPublisherFragment.showPublisherWidget(true);
			mPublisherFragment.initPublisherUI();
			mPublisherStatusFragment.showPubStatusWidget(true);
			mPublisherStatusFragment.initPubStatusUI();
		}
Exemple #39
0
 public void OnStreamDestroyed(PublisherKit p0, Stream p1)
 {
     //throw new NotImplementedException();
 }
Exemple #40
0
 public void OnStreamDestroyed(PublisherKit publisher, Stream stream)
 {
     UnsubscribeFromStream(stream);
 }