예제 #1
0
        private async void OnRequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
        {
            AppServiceDeferral deferral = args.GetDeferral();
            ValueSet           message  = args.Request.Message;

            if (message == null || !message.ContainsKey("type"))
            {
                return;
            }

            switch (message["type"])
            {
            case "speaking":
                Speak speak = JsonConvert.DeserializeObject <Speak>(message["payload"] as string);
                Messenger.Default.Send(new SpeakMessage(speak));
                break;

            case "audioInData":
                AudioInData?.Invoke(this, message["data"] as float[]);
                break;

            case "audioOutData":
                AudioOutData?.Invoke(this, message["data"] as float[]);
                break;
            }
            deferral.Complete();
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebrtcManager"/> class.
 /// </summary>
 /// <param name="inputDeviceId">The id of the input device.</param>
 /// <param name="outputDeviceId">The id of the output device.</param>
 public WebrtcManager()
 {
     manager = new Webrtc.WebrtcManager();
     manager.IpAndPortObtained += (ip, port) => IpAndPortObtained.Invoke(this, new Tuple <string, ushort>(ip, port));
     manager.AudioInData       += (sender, data) => AudioInData?.Invoke(sender, data);
     manager.AudioOutData      += (sender, data) => AudioOutData?.Invoke(sender, data);
     manager.Speaking          += (sender, data) => Speaking?.Invoke(sender, data);
 }