private async void StartButton_Click(Object sender, RoutedEventArgs e) { StreamSocketListener listener = new StreamSocketListener(); listener.ConnectionReceived += Listener_ConnectionReceived; capture = new UWPVideoCaptureHelper(); try { MediaCaptureInitializationSettings settings = await GetMediaCaptureSettingsAsync(Windows.Devices.Enumeration.Panel.Back, (int)Preview.Width, (int)Preview.Height, 30); await listener.BindEndpointAsync(new HostName("127.0.0.1"), "25"); capturing = true; bool result = await capture.Start(settings, (int)Preview.Width, (int)Preview.Height, 25); System.Diagnostics.Debug.WriteLine("Capture start returned " + result); } catch (System.Runtime.InteropServices.COMException cex) { var error = cex.HResult; } }
public async Task<bool> Start(Panel panel, int width,int height, int frameRate) { try { MediaCaptureInitializationSettings mediaInitSettings = await getMediaCaptureSettingsAsync(panel, width, height, frameRate); uwpCapture = new UWPVideoCaptureHelper(); int port = await getLocalPort(); if(port == 0) { return false; } displayRequest.RequestActive(); capturing = true; return await uwpCapture.Start(mediaInitSettings, width, height, port); } catch(Exception ex) { Debug.WriteLine("Could not find device " + ex.ToString()); return false; } }
private async void StartButton_Click(Object sender, RoutedEventArgs e) { StreamSocketListener listener = new StreamSocketListener(); listener.ConnectionReceived += Listener_ConnectionReceived; capture = new UWPVideoCaptureHelper(); try { MediaCaptureInitializationSettings settings = await GetMediaCaptureSettingsAsync(Windows.Devices.Enumeration.Panel.Back, (int)Preview.Width, (int)Preview.Height, 30); await listener.BindEndpointAsync(new HostName("127.0.0.1"), "25"); capturing = true; bool result = await capture.Start(settings,(int)Preview.Width,(int)Preview.Height, 25); System.Diagnostics.Debug.WriteLine("Capture start returned " + result); } catch(System.Runtime.InteropServices.COMException cex) { var error = cex.HResult; } }
public async Task <bool> Start(Panel panel, int width, int height, int frameRate) { try { MediaCaptureInitializationSettings mediaInitSettings = await getMediaCaptureSettingsAsync(panel, width, height, frameRate); uwpCapture = new UWPVideoCaptureHelper(); int port = await getLocalPort(); if (port == 0) { return(false); } displayRequest.RequestActive(); capturing = true; return(await uwpCapture.Start(mediaInitSettings, width, height, port)); } catch (Exception ex) { Debug.WriteLine("Could not find device " + ex.ToString()); return(false); } }