// Disconnect from remote resources, dispose of local resources, and exit. private void disconnectAndExit() { lock (quit[0]) { if (quit[0] == Boolean.True) { return; } quit[0] = Boolean.True; if (pc != null) { pc.Dispose(); pc = null; } if (appRtcClient != null) { appRtcClient.sendMessage("{\"type\": \"bye\"}"); appRtcClient.disconnect(); appRtcClient = null; } if (videoSource != null) { videoSource.Dispose(); videoSource = null; } if (factory != null) { factory.Dispose(); factory = null; } Finish(); } }
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..."); }
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..."); }