Example #1
0
 public void OnVideoTrackAdded(Participant participant, VideoTrack videoTrack)
 {
     try
     {
         Console.WriteLine("ParticipantListener.OnVideoTrackAdded");
         this.mainActivity.primaryVideoView.SetMirror(true);
         videoTrack.AddRenderer(this.mainActivity.primaryVideoView);
     }
     catch (Exception e)
     {
         Console.WriteLine("ParticipantListener.OnVideoTrackAdded " + e.Message);
     }
 }
Example #2
0
        public void SetRemoteVideoTrack(TwilioVideo.VideoTrack videoTrack)
        {
            var trackId = videoTrack?.TrackId;

            if (_remoteVideoTrackId == trackId)
            {
                return;
            }

            _remoteVideoTrackId = trackId;
            if (UserVideoTrack == null)
            {
                UserVideoTrack = videoTrack;


                UserVideoTrack.AddRenderer(_UserprimaryVideo);

                _thumbnailVideo.Visibility = LocalvideoTrack == null ? ViewStates.Invisible : ViewStates.Visible;
            }
        }
        public void SetRemoteVideoTrack(VideoTrack track)
        {
            try
            {
                var trackId = track?.Name;

                if (RemoteVideoTrackId == trackId)
                {
                    return;
                }

                RemoteVideoTrackId = trackId;
                if (UserVideoTrack == null)
                {
                    UserVideoTrack = track;
                    UserVideoTrack?.AddRenderer(UserPrimaryVideo);
                    ThumbnailVideo.Visibility = LocalVideoTrack == null ? ViewStates.Invisible : ViewStates.Visible;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public void onIceServers(IList <PeerConnection.IceServer> iceServers)
        {
            factory = new PeerConnectionFactory();
            pc      = factory.CreatePeerConnection(iceServers, appRtcClient.pcConstraints(), pcObserver);

            // Uncomment to get ALL WebRTC tracing and SENSITIVE libjingle logging.
            // NOTE: this _must_ happen while |factory| is alive!
            // Logging.enableTracing(
            //     "logcat:",
            //     EnumSet.of(Logging.TraceLevel.TRACE_ALL),
            //     Logging.Severity.LS_SENSITIVE);

            {
                PeerConnection finalPC = pc;
                //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
                //ORIGINAL LINE: final Runnable repeatedStatsLogger = new Runnable()
                IRunnable repeatedStatsLogger = new RunnableAnonymousInnerClassHelper(this, finalPC);
                vsv.PostDelayed(repeatedStatsLogger, 10000);
            }

            {
                logAndToast("Creating local video source...");
                MediaStream lMS = factory.CreateLocalMediaStream("ARDAMS");
                if (appRtcClient.videoConstraints() != null)
                {
                    VideoCapturer capturer = VideoCapturer;
                    videoSource = factory.CreateVideoSource(capturer, appRtcClient.videoConstraints());
                    VideoTrack videoTrack = factory.CreateVideoTrack("ARDAMSv0", videoSource);
                    videoTrack.AddRenderer(new VideoRenderer(new VideoCallbacks(this, vsv, VideoStreamsView.Endpoint.LOCAL)));
                    lMS.AddTrack(videoTrack);
                }
                lMS.AddTrack(factory.CreateAudioTrack("ARDAMSa0"));
                pc.AddStream(lMS, new MediaConstraints());
            }
            logAndToast("Waiting for ICE candidates...");
        }