An empty page that can be used on its own or navigated to within a Frame.
Inheritance: Windows.UI.Xaml.Controls.Page
コード例 #1
7
        public void Start(VideoChat videoChat, Action<string> callback)
        {
            // WebRTC audio and video streams require us to first get access to
            // the local media (microphone, camera, or both).
            UserMedia.GetMedia(new GetMediaArgs(Audio, Video)
            {
                // Specify an audio capture provider, a video
                // capture provider, an audio render provider,
                // and a video render provider. The IceLink
                // SDK comes bundled with video support for
                // WinForms and WPF, and uses NAudio for audio
                // support. For lower latency audio, use ASIO.
                AudioCaptureProvider = new NAudioCaptureProvider(),
                VideoCaptureProvider = new VideoCaptureProvider(),
                CreateAudioRenderProvider = (e) =>
                {
                    return new NAudioRenderProvider();
                },
                CreateVideoRenderProvider = (e) =>
                {
                    return new VideoRenderProvider(LayoutScale.Contain);
                },
                VideoWidth = VideoWidth,     // optional
                VideoHeight = VideoHeight,    // optional
                VideoFrameRate = VideoFrameRate, // optional
                OnFailure = (e) =>
                {
                    callback(string.Format("Could not get media. {0}", e.Exception.Message));
                },
                OnSuccess = (e) =>
                {
                    // We have successfully acquired access to the local
                    // audio/video device! Grab a reference to the media.
                    // Internally, it maintains access to the local audio
                    // and video feeds coming from the device hardware.
                    LocalMediaStream = e.LocalStream;

                    // Wire up the UI.
                    VideoChat = videoChat;
                    Win8LayoutManager.SafeInvoke(() =>
                    {
                        VideoChat.GetAudioDevices().ItemsSource = LocalMediaStream.GetAudioDeviceNames();
                        VideoChat.GetVideoDevices().ItemsSource = LocalMediaStream.GetVideoDeviceNames();
                        VideoChat.GetAudioDevices().SelectionChanged += SwitchAudioDevice;
                        VideoChat.GetVideoDevices().SelectionChanged += SwitchVideoDevice;
                        VideoChat.GetAudioDevices().SelectedIndex = LocalMediaStream.GetAudioDeviceNumber();
                        VideoChat.GetVideoDevices().SelectedIndex = LocalMediaStream.GetVideoDeviceNumber();
                    });

                    // Keep the UI updated if devices are switched.
                    LocalMediaStream.OnAudioDeviceNumberChanged += UpdateSelectedAudioDevice;
                    LocalMediaStream.OnVideoDeviceNumberChanged += UpdateSelectedVideoDevice;

                    // This is our local video control, a WinForms control
                    // that displays video coming from the capture source.
                    var localVideoControl = (FrameworkElement)e.LocalVideoControl;

                    // Create an IceLink layout manager, which makes the task
                    // of arranging video controls easy. Give it a reference
                    // to a WinForms control that can be filled with video feeds.
                    // Use WpfLayoutManager for WPF-based applications.
                    LayoutManager = new Win8LayoutManager(VideoChat.GetContainer());

                    // Display the local video control.
                    LayoutManager.SetLocalVideoControl(localVideoControl);

                    callback(null);
                }
            });
        }
コード例 #2
0
        public void Stop(Action <string> callback)
        {
            // Clear out the layout manager.
            if (LayoutManager != null)
            {
                LayoutManager.RemoveRemoteVideoControls();
                LayoutManager.UnsetLocalVideoControl();
                LayoutManager = null;
            }

            if (LocalMediaStream != null)
            {
                LocalMediaStream.OnAudioDeviceNumberChanged -= UpdateSelectedAudioDevice;
                LocalMediaStream.OnVideoDeviceNumberChanged -= UpdateSelectedVideoDevice;
            }

            if (VideoChat != null)
            {
                VideoChat.GetAudioDevices().SelectionChanged -= SwitchAudioDevice;
                VideoChat.GetVideoDevices().SelectionChanged -= SwitchVideoDevice;
                VideoChat = null;
            }

            // Stop the local media stream.
            if (LocalMediaStream != null)
            {
                LocalMediaStream.Stop();
                LocalMediaStream = null;
            }

            callback(null);
        }
コード例 #3
0
        public void Start(VideoChat videoChat, Action <string> callback)
        {
            // WebRTC audio and video streams require us to first get access to
            // the local media (microphone, camera, or both).
            UserMedia.GetMedia(new GetMediaArgs(Audio, Video)
            {
                // Specify an audio capture provider, a video
                // capture provider, an audio render provider,
                // and a video render provider. The IceLink
                // SDK comes bundled with video support for
                // WinForms and WPF, and uses NAudio for audio
                // support. For lower latency audio, use ASIO.
                AudioCaptureProvider      = new NAudioCaptureProvider(),
                VideoCaptureProvider      = new VideoCaptureProvider(),
                CreateAudioRenderProvider = (e) =>
                {
                    return(new NAudioRenderProvider());
                },
                CreateVideoRenderProvider = (e) =>
                {
                    return(new VideoRenderProvider(LayoutScale.Contain));
                },
                VideoWidth     = VideoWidth,     // optional
                VideoHeight    = VideoHeight,    // optional
                VideoFrameRate = VideoFrameRate, // optional
                OnFailure      = (e) =>
                {
                    callback(string.Format("Could not get media. {0}", e.Exception.Message));
                },
                OnSuccess = (e) =>
                {
                    // We have successfully acquired access to the local
                    // audio/video device! Grab a reference to the media.
                    // Internally, it maintains access to the local audio
                    // and video feeds coming from the device hardware.
                    LocalMediaStream = e.LocalStream;

                    // Wire up the UI.
                    VideoChat = videoChat;
                    Win8LayoutManager.SafeInvoke(() =>
                    {
                        VideoChat.GetAudioDevices().ItemsSource       = LocalMediaStream.GetAudioDeviceNames();
                        VideoChat.GetVideoDevices().ItemsSource       = LocalMediaStream.GetVideoDeviceNames();
                        VideoChat.GetAudioDevices().SelectionChanged += SwitchAudioDevice;
                        VideoChat.GetVideoDevices().SelectionChanged += SwitchVideoDevice;
                        VideoChat.GetAudioDevices().SelectedIndex     = LocalMediaStream.GetAudioDeviceNumber();
                        VideoChat.GetVideoDevices().SelectedIndex     = LocalMediaStream.GetVideoDeviceNumber();
                    });

                    // Keep the UI updated if devices are switched.
                    LocalMediaStream.OnAudioDeviceNumberChanged += UpdateSelectedAudioDevice;
                    LocalMediaStream.OnVideoDeviceNumberChanged += UpdateSelectedVideoDevice;

                    // This is our local video control, a WinForms control
                    // that displays video coming from the capture source.
                    var localVideoControl = (FrameworkElement)e.LocalVideoControl;

                    // Create an IceLink layout manager, which makes the task
                    // of arranging video controls easy. Give it a reference
                    // to a WinForms control that can be filled with video feeds.
                    // Use WpfLayoutManager for WPF-based applications.
                    LayoutManager = new Win8LayoutManager(VideoChat.GetContainer());

                    // Display the local video control.
                    LayoutManager.SetLocalVideoControl(localVideoControl);

                    callback(null);
                }
            });
        }
コード例 #4
0
 public void StartLocalMedia(VideoChat videoChat, Action<string> callback)
 {
     LocalMedia = new LocalMedia();
     LocalMedia.Start(videoChat, callback);
 }
コード例 #5
0
 public void StartLocalMedia(VideoChat videoChat, Action <string> callback)
 {
     LocalMedia = new LocalMedia();
     LocalMedia.Start(videoChat, callback);
 }
コード例 #6
0
        public void Stop(Action<string> callback)
        {
            // Clear out the layout manager.
            if (LayoutManager != null)
            {
                LayoutManager.RemoveRemoteVideoControls();
                LayoutManager.UnsetLocalVideoControl();
                LayoutManager = null;
            }

            if (LocalMediaStream != null)
            {
                LocalMediaStream.OnAudioDeviceNumberChanged -= UpdateSelectedAudioDevice;
                LocalMediaStream.OnVideoDeviceNumberChanged -= UpdateSelectedVideoDevice;
            }

            if (VideoChat != null)
            {
                VideoChat.GetAudioDevices().SelectionChanged -= SwitchAudioDevice;
                VideoChat.GetVideoDevices().SelectionChanged -= SwitchVideoDevice;
                VideoChat = null;
            }

            // Stop the local media stream.
            if (LocalMediaStream != null)
            {
                LocalMediaStream.Stop();
                LocalMediaStream = null;
            }

            callback(null);
        }