コード例 #1
0
        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...");
        }