public async Task <DtoCaptureCapabilities> GetVideoCaptureCapabilitiesAsync(DtoMediaDevice device)
        {
            MediaDevice checkDevice  = DtoExtensions.FromDto(device);
            var         capabilities = await checkDevice.GetVideoCaptureCapabilities();

            return(DtoExtensions.ToDto(capabilities.ToArray()));
        }
 public void SetAudioPlayoutDevice(DtoMediaDevice device)
 {
     _audioPlayoutDevice = device;
     _localSettings.Values[MediaSettingsIds.AudioPlayoutDeviceSettings] = device?.Id;
     if ((null != device) &&
         (null != Media))
     {
         Media.SelectAudioPlayoutDevice(DtoExtensions.FromDto(device));
     }
 }
        public override async Task OnEnteringState()
        {
            Debug.Assert(Context.PeerConnection == null);

            Context.VoipCoordinator.StartOutgoingCall(_callRequest);

            var config = new RTCConfiguration
            {
                IceServers = WebRtcSettingsUtils.ToRTCIceServer(IceServerSettings.IceServers)
            };

            Context.PeerConnection = new RTCPeerConnection(config);

            Context.LocalStream = await Context.Media.GetUserMedia(new RTCMediaStreamConstraints
            {
                videoEnabled = _callRequest.VideoEnabled,
                audioEnabled = true
            });

            Context.PeerConnection.AddStream(Context.LocalStream);
            var sdpOffer = await Context.PeerConnection.CreateOffer();

            var sdpString = sdpOffer.Sdp;

            SdpUtils.SelectCodecs(ref sdpString, DtoExtensions.FromDto(Context.GetAudioCodec()), DtoExtensions.FromDto(Context.GetVideoCodec()));
            sdpOffer.Sdp = sdpString;
            await Context.PeerConnection.SetLocalDescription(sdpOffer);

            var tracks = Context.LocalStream.GetVideoTracks();

            if (tracks.Count > 0)
            {
#if WIN10
                var source = Context.Media.CreateMediaSource(tracks[0], VoipContext.LocalMediaStreamId);
#else
                var source = Context.Media.CreateMediaStreamSource(tracks[0], 30, VoipContext.LocalMediaStreamId);
#endif
                Context.LocalVideoRenderer.SetupRenderer(Context.ForegroundProcessId, source, Context.LocalVideoControlSize);
            }

            Context.SendToPeer(RelayMessageTags.SdpOffer, sdpOffer.Sdp);
        }