public void ConnectToServer() { var signalhost = ServerInputTextField.text.Split(':'); var host = string.Empty; var port = string.Empty; if (signalhost.Length > 1) { host = signalhost[0]; port = signalhost[1]; } else { host = signalhost[0]; port = "8888"; } int heartbeatMs; if (!int.TryParse(HeartbeatInputTextField.text, out heartbeatMs)) { heartbeatMs = -1; } #if !UNITY_EDITOR _webRtcControl.ConnectToServer(host, port, PeerInputTextField.text, heartbeatMs); #endif }
public void Run() { // Initializes webrtc. _webRtcControl = new WebRtcControl("ms-appx:///webrtcConfig.json"); _webRtcControl.OnInitialized += (() => { _webRtcControl.ConnectToServer(); }); Conductor.Instance.OnAddRemoteStream += ((evt) => { var peerVideoTrack = evt.Stream.GetVideoTracks().FirstOrDefault(); if (peerVideoTrack != null) { var media = Media.CreateMedia().CreateMediaStreamSource( peerVideoTrack, DEFAULT_FRAME_RATE, DEFAULT_MEDIA_SOURCE_ID); _appCallbacks.SetMediaStreamSource((MediaStreamSource)media); } _webRtcControl.IsReadyToDisconnect = true; }); _webRtcControl.Initialize(); // Starts the main render loop. _appCallbacks.Run(); }
public void Run() { // Initializes webrtc. _webRtcControl = new WebRtcControl("ms-appx:///webrtcConfig.json"); _webRtcControl.OnInitialized += (() => { _webRtcControl.ConnectToServer(); }); Conductor.Instance.OnAddRemoteStream += ((evt) => { var peerVideoTrack = evt.Stream.GetVideoTracks().FirstOrDefault(); if (peerVideoTrack != null) { MediaSourceReadyDelegate mediaSourceReadyDelegate = (mediaSource) => { _appCallbacks.SetMediaStreamSource( (MediaStreamSource)mediaSource, VIDEO_FRAME_WIDTH, VIDEO_FRAME_HEIGHT); }; SampleTimestampDelegate sampleTimestampDelegate = (id, timestamp) => { _appCallbacks.OnSampleTimestamp(id, timestamp); }; FpsReportRequestedDelegate fpsReportRequestedDelegate = () => { return(_appCallbacks.OnFpsReportRequested()); }; Media.CreateMedia().CreateMediaStreamSource( peerVideoTrack, DEFAULT_MEDIA_SOURCE_ID, VIDEO_FRAME_WIDTH, VIDEO_FRAME_HEIGHT, mediaSourceReadyDelegate, sampleTimestampDelegate, fpsReportRequestedDelegate); } _webRtcControl.IsReadyToDisconnect = true; }); _webRtcControl.Initialize(); // Starts the main render loop. _appCallbacks.Run(); }
public void Run() { // Initializes webrtc. _webRtcControl = new WebRtcControl(WEBRTC_CONFIG_FILE); _webRtcControl.OnInitialized += (() => { _webRtcControl.ConnectToServer(); }); Conductor.Instance.OnAddRemoteStream += ((evt) => { var peerVideoTrack = evt.Stream.GetVideoTracks().FirstOrDefault(); if (peerVideoTrack != null) { PredictionTimestampDelegate predictionTimestampDelegate = (id, timestamp) => { _appCallbacks.OnPredictionTimestamp(id, timestamp); }; FpsReportDelegate fpsReportDelegate = () => { return(_appCallbacks.FpsReport()); }; var mediaSource = Media.CreateMedia().CreateMediaStreamSource( peerVideoTrack, DEFAULT_MEDIA_SOURCE_TYPE, DEFAULT_MEDIA_SOURCE_ID, VIDEO_FRAME_WIDTH, VIDEO_FRAME_HEIGHT, predictionTimestampDelegate, fpsReportDelegate); _appCallbacks.SetMediaStreamSource( (MediaStreamSource)mediaSource, VIDEO_FRAME_WIDTH, VIDEO_FRAME_HEIGHT); } _webRtcControl.IsReadyToDisconnect = true; }); _webRtcControl.Initialize(); // Starts the main render loop. _appCallbacks.Run(); }
public void ConnectToServer() { var signalhost = ServerInputTextField.text.Split(':'); var host = string.Empty; var port = string.Empty; if (signalhost.Length > 1) { host = signalhost[0]; port = signalhost[1]; } else { host = signalhost[0]; port = "8888"; } #if !UNITY_EDITOR _webRtcControl.ConnectToServer(host, port, PeerInputTextField.text); #endif }
private void ConnectServerBtn_Click(object sender, RoutedEventArgs e) { RunOnUiThread(() => { var signalhost = signallingHost.Split(':'); var host = string.Empty; var port = string.Empty; if (signalhost.Length > 1) { host = signalhost[0]; port = signalhost[1]; } else { host = signalhost[0]; port = "8888"; } _webRtcControl.ConnectToServer(host, port, "WebRTCWrapper"); } ); }
private void ConnectServerBtn_Click(object sender, RoutedEventArgs e) { RunOnUiThread(() => { var signalhost = signallingHost.Split(':'); var host = string.Empty; var port = string.Empty; if (signalhost.Length > 1) { host = signalhost[0]; port = signalhost[1]; } else { host = signalhost[0]; port = "8888"; } // TODO: make the heartbeat interval configurable _webRtcControl.ConnectToServer(host, port, "WebRTCWrapper", 5000); } ); }