private void OnUserEvent(object sender, UserStateChangedEvent e) { Debug.WriteLine("Got new user event for user with id: " + e.UserId); Debug.WriteLine("User just " + (e.IsConnected ? "joined" : "left") + "the scope"); if (e.IsConnected) { Debug.WriteLine("User is " + (!e.AudioPublished ? "not" : "") + " publishing audio stream"); Debug.WriteLine("User is " + (!e.VideoPublished ? "not" : "") + " publishing video stream"); if (e.VideoPublished) { Debug.WriteLine("Creating renderer for remote user sink: " + e.VideoSinkId); var rOptions = new RenderOptions(); rOptions.mirror = true; rOptions.sinkId = e.VideoSinkId; rOptions.filter = VideoScalingFilter.FAST_BILINEAR; var rHandler = new ResultHandler <RenderingWidget>((_1) => AppendRenderer(RemoteVideoPanel, _1)); Platform.renderSink(Platform.R <RenderingWidget>(rHandler, GenErrHandler("renderSink")), rOptions); } } else { } }
public void testCustomRendering() { // 1. Set proper video capture device Dictionary<string, string> devs = null; ; _service.getVideoCaptureDeviceNames(createDevsResponder()); devs = awaitDictResult("getVideoCaptureDeviceNames", 15000); Assert.IsTrue(devs.Count > 0); Console.Error.WriteLine("Setting the device"); _service.setVideoCaptureDevice(createVoidResponder(), devs.Keys.First()); awaitVoidResult("setVideoCaptureDevice", 15000); // 2. Do the real test Console.Error.WriteLine("Starting local video"); _service.startLocalVideo(createStringResponder()); string sinkId = awaitStringResult("startLocalVideo", 15000); Assert.That(sinkId.Length > 0); Console.Error.WriteLine("Creating renderer"); RenderOptions ro = new RenderOptions(); ro.filter = VideoScalingFilter.FAST_BILINEAR; ro.mirror = true; ro.sinkId = sinkId; Console.Error.WriteLine("Starting rendering"); _service.manualRenderSink(createManualRendererResponder(), ro); ManualRenderer mRenderer = awaitManualRendererResult(); Console.Error.WriteLine("Rendering started"); TestRenderingForm renderingForm = new TestRenderingForm(mRenderer); renderingForm.ShowDialog(); _service.stopLocalVideo(createVoidResponder()); awaitVoidResult(); }
private void OnLocalVideoStarted(string sinkId) { Debug.WriteLine("Local video started. Creating renderer"); var rOptions = new RenderOptions(); rOptions.mirror = true; rOptions.sinkId = sinkId; rOptions.filter = VideoScalingFilter.FAST_BILINEAR; var rHandler = new ResultHandler <RenderingWidget>((_1) => AppendRenderer(LocalVideoPanel, _1)); Platform.renderSink(Platform.R <RenderingWidget>(rHandler, GenErrHandler("renderSink")), rOptions); Debug.WriteLine("Connecting to scope with id: " + ViewModel.Config.ScopeId); var connDescr = new ConnectionDescription(); connDescr.autopublishAudio = true; connDescr.autopublishVideo = true; connDescr.scopeId = ViewModel.Config.ScopeId; connDescr.url = "174.127.76.172:443/" + ViewModel.Config.ScopeId; connDescr.token = ViewModel.UserId.ToString(CultureInfo.InvariantCulture); connDescr.lowVideoStream.maxBitRate = 64; connDescr.lowVideoStream.maxWidth = 150; connDescr.lowVideoStream.maxHeight = 150; connDescr.lowVideoStream.maxFps = 5; connDescr.lowVideoStream.publish = true; connDescr.lowVideoStream.receive = true; connDescr.highVideoStream.maxBitRate = 512; connDescr.highVideoStream.maxWidth = 150; connDescr.highVideoStream.maxHeight = 150; connDescr.highVideoStream.maxFps = 15; connDescr.highVideoStream.publish = true; connDescr.highVideoStream.receive = true; connDescr.authDetails = GenAuthDetails(ViewModel.Config.ScopeId, ViewModel.UserId); _connectedScopeId = ViewModel.Config.ScopeId; Platform.Service.connect(GenGenericResponder <object>("connect"), connDescr); Platform.Service.publish(GenGenericResponder <object>("publishVideo"), _connectedScopeId, MediaType.VIDEO, null); ViewModel.VideoInitCompleted = true; Action a1 = () => InitVideoText.Visibility = Visibility.Collapsed; Application.Current.Dispatcher.BeginInvoke(a1, null); if (_availableVideoDevices.Count >= 2 && ToggleCamerasButton != null) { Action a = () => ToggleCamerasButton.Visibility = Visibility.Visible; System.Windows.Application.Current.Dispatcher.BeginInvoke(a, null); } }
private void OnLocalVideoChanged(string sinkId) { Debug.WriteLine("Local video changed. Creating renderer"); var rOptions = new RenderOptions(); rOptions.mirror = true; rOptions.sinkId = sinkId; rOptions.filter = VideoScalingFilter.FAST_BILINEAR; var rHandler = new ResultHandler <RenderingWidget>((_1) => AppendRenderer(LocalVideoPanel, _1)); Platform.renderSink(Platform.R <RenderingWidget>(rHandler, GenErrHandler("renderSink")), rOptions); }
private void startRenderBtn_Click(object sender, EventArgs e) { RenderOptions rOptions = new RenderOptions(); rOptions.mirror = false; rOptions.filter = VideoScalingFilter.FAST_BILINEAR; rOptions.sinkId = _localPreviewSinkId; Platform.renderSink(Platform.R<RenderingWidget>(onRenderStarted), rOptions); }
internal static ADLRenderRequest toNative(RenderOptions options) { ADLRenderRequest result = new ADLRenderRequest(); result.sinkId = StringHelper.toNative(options.sinkId); result.mirror = options.mirror; result.filter = StringHelper.toNative(options.filter.StringValue); result.opaque = IntPtr.Zero; return result; }
// ===================================================================== /// <summary> /// /// </summary> /// <param name="responder"></param> /// <param name="options"></param> public void renderSink(Responder<RenderingWidget> responder, RenderOptions options) { PendingCall call = new PendingCall(responder); renderSinkInternal(call, options); }
public void manualRenderSink(Responder<ManualRenderer> responder, RenderOptions options) { PendingCall call = new PendingCall(responder); renderSinkInternal(call, options); }
/** * Private helpers * ===================================================================== */ private void renderSinkInternal(PendingCall call, RenderOptions options) { int callId = _callIdGenerator++; ManualRenderer renderer = new ManualRenderer(_platformHandle, onRendererPreDispose); call.manualRenderer = renderer; _pendingCalls[callId] = call; ADLRenderRequest nReq = RenderOptions.toNative(options); nReq.invalidateCallback = renderer.getInvalidateClbck(); Console.Error.WriteLine("Requesting SDK to start rendering sink"); NativeAPI.adl_render_sink(_renderResponder, _platformHandle, new IntPtr(callId), ref nReq); }
public void testRenderingWidget() { // 1. Set proper video capture device Dictionary<string, string> devs = null; ; _service.getVideoCaptureDeviceNames(createDevsResponder()); devs = awaitDictResult("getVideoCaptureDeviceNames", 15000); Assert.IsTrue(devs.Count > 0); Console.Error.WriteLine("Setting the device"); _service.setVideoCaptureDevice(createVoidResponder(), devs.Keys.First()); awaitVoidResult("setVideoCaptureDevice", 15000); // 2. Do the real test Console.Error.WriteLine("Starting local video"); _service.startLocalVideo(createStringResponder()); string sinkId = awaitStringResult("startLocalVideo", 15000); Assert.That(sinkId.Length > 0); Console.Error.WriteLine("Creating renderer"); RenderOptions ro = new RenderOptions(); ro.filter = VideoScalingFilter.FAST_BILINEAR; ro.mirror = true; ro.sinkId = sinkId; Console.Error.WriteLine("Starting rendering"); Form renderingForm = new Form(); renderingForm.Width = 360; renderingForm.Height = 240; _service.renderSink(createRendererResponder(), ro); RenderingWidget renderer = awaitRendererResult(); renderer.Width = 320; renderer.Height = 240; renderer.SetBounds(10, 10, 320, 240); renderingForm.Controls.Add(renderer); renderingForm.ShowDialog(); _service.stopLocalVideo(createVoidResponder()); awaitVoidResult(); }