private void Session_StreamReceived(object sender, Session.StreamEventArgs e)
        {
            Trace.WriteLine("Session stream received");

            SampleVideoRenderer renderer = new SampleVideoRenderer();

            renderer.EnableBlueFilter = PublisherVideo.EnableBlueFilter;

            SubscriberGrid.Children.Add(renderer);
            UpdateGridSize(SubscriberGrid.Children.Count);
            Subscriber subscriber = new Subscriber.Builder(Context.Instance, e.Stream)
            {
                Renderer = renderer
            }.Build();

            SubscriberByStream.Add(e.Stream, subscriber);

            try
            {
                Session.Subscribe(subscriber);
            }
            catch (OpenTokException ex)
            {
                Trace.WriteLine("OpenTokException " + ex.ToString());
            }
        }
        private void Session_StreamReceived(object sender, Session.StreamEventArgs e)
        {
            Subscriber subscriber = new Subscriber.Builder(Context.Instance, e.Stream)
            {
                Renderer = SubscriberVideo
            }.Build();

            Session.Subscribe(subscriber);
        }
        /// <summary>
        /// Called if another client stops publishing a stream to the session
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Session_StreamDropped(object sender, Session.StreamEventArgs e)
        {
            log.Debug("Stream stopped in session. " + e.Stream.Name);
            var contact = _availableContacts[e.Stream.Name];

            contact.VidoeStream = e.Stream;
            contact.IsOnline    = false;
            ContactStatusChangedHandler?.Invoke(this, contact);
        }
Beispiel #4
0
        /// <summary>
        /// When another client publishes a stream to a session, the Session.StreamReceived message is sent and this method is called
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Session_StreamReceived(object sender, Session.StreamEventArgs e)
        {
            if (_subscriber != null)
            {
                _session.Unsubscribe(_subscriber);
                _subscriber.Dispose();
            }

            System.Diagnostics.Debug.WriteLine("Stream received: " + e.Stream.Name);
            _subscriber = new Subscriber(Context.Instance, e.Stream, SubscriberVideo);
            _session.Subscribe(_subscriber);
        }
    private void Session_StreamReceived(object sender, Session.StreamEventArgs e)
    {
        if (subscriber != null)
        {
            return; // This sample can only handle one subscriber
        }
        Debug.LogFormat("Stream received {0}", e.Stream.Id);
        subscriberRender = new VideoRender(subscriberRenderer.rendererId);

        subscriber = new Subscriber(Context.Instance, e.Stream, subscriberRender);
        session.Subscribe(subscriber);

        subscriberRenderer.Enabled = true;
    }
        private void Session_StreamReceived(object sender, Session.StreamEventArgs e)
        {
            Console.WriteLine("Session stream received");
            Subscriber subscriber = new Subscriber.Builder(Context.Instance, e.Stream)
            {
                Renderer = (IVideoRenderer)wpfSubscriberHost.Child
            }.Build();

            subscriberByStream.TryAdd(e.Stream, subscriber);

            try
            {
                session.Subscribe(subscriber);
            }
            catch (OpenTokException ex)
            {
                Console.WriteLine("OpenTokException " + ex.ToString());
            }
        }
Beispiel #7
0
        private void Session_StreamReceived(object sender, Session.StreamEventArgs e)
        {
            Console.WriteLine("Session stream received");
            VideoRenderer renderer = new VideoRenderer();

            SubscriberGrid.Children.Add(renderer);
            UpdateGridSize(SubscriberGrid.Children.Count);
            Subscriber subscriber = new Subscriber(Context.Instance, e.Stream, renderer);

            SubscriberByStream.Add(e.Stream, subscriber);

            try
            {
                Session.Subscribe(subscriber);
            }
            catch (OpenTokException ex)
            {
                Console.WriteLine("OpenTokException " + ex.ToString());
            }
        }
        private void Session_StreamDropped(object sender, Session.StreamEventArgs e)
        {
            Console.WriteLine("Session stream dropped");
            var subscriber = subscriberByStream[e.Stream];

            if (subscriber != null)
            {
                Subscriber outsubs;
                subscriberByStream.TryRemove(e.Stream, out outsubs);

                try
                {
                    session.Unsubscribe(subscriber);
                }
                catch (OpenTokException ex)
                {
                    Console.WriteLine("OpenTokException " + ex.ToString());
                }
            }
        }
Beispiel #9
0
        private void Session_StreamDropped(object sender, Session.StreamEventArgs e)
        {
            Console.WriteLine("Session stream dropped");
            var subscriber = SubscriberByStream[e.Stream];

            if (subscriber != null)
            {
                SubscriberByStream.Remove(e.Stream);
                try
                {
                    Session.Unsubscribe(subscriber);
                }
                catch (OpenTokException ex)
                {
                    Console.WriteLine("OpenTokException " + ex.ToString());
                }

                SubscriberGrid.Children.Remove((UIElement)subscriber.VideoRenderer);
                UpdateGridSize(SubscriberGrid.Children.Count);
            }
        }
Beispiel #10
0
 private void Session_StreamHasAudioChanged(object sender, Session.StreamEventArgs e)
 {
 }
Beispiel #11
0
        private void Session_StreamReceived(object sender, Session.StreamEventArgs e)
        {
            subscriber = new Subscriber(Context.Instance, e.Stream, SubscriberVideo);

            Session.Subscribe(subscriber);
        }