Exemplo n.º 1
0
 private async void ReceiverChannel_MessageReceived(object sender, ChromecastSSLClientDataReceivedArgs e)
 {
     var json = e.Message.PayloadUtf8;
     var response = JsonConvert.DeserializeObject<ChromecastStatusResponse>(json);
     if (response.ChromecastStatus == null) return;
     Client.ChromecastStatus = response.ChromecastStatus;
     Client.Volume = response.ChromecastStatus.Volume;
     await ConnectToApplication(Client.ChromecastApplicationId);
 }
Exemplo n.º 2
0
 private void OnMessageReceived(object sender, ChromecastSSLClientDataReceivedArgs chromecastSSLClientDataReceivedArgs)
 {
     var json = chromecastSSLClientDataReceivedArgs.Message.PayloadUtf8;
     var response = JsonConvert.DeserializeObject<MediaStatusResponse>(json);
     if (response.status == null) return; //TODO: Should probably raise LOAD_FAILED event
     if (response.status.Count == 0) return; //Initializing
     Client.MediaStatus = response.status.First();
     if (Client.MediaStatus.Volume != null) Client.Volume = Client.MediaStatus.Volume;
     Client.CurrentMediaSessionId = Client.MediaStatus.MediaSessionId;
 }
Exemplo n.º 3
0
 private async void HeartbeatChannel_MessageReceived(object sender, ChromecastSSLClientDataReceivedArgs e)
 {
     Debug.WriteLine(e.Message.GetJsonType());
     if (Client.Connected || e.Message.GetJsonType() != "PONG") return;
     //Wait 100 milliseconds before sending GET_STATUS because chromecast was sending CLOSE back without a wait
     await Task.Delay(100);
     Client.ReceiverChannel.GetChromecastStatus();
     //Wait 100 milliseconds to make sure that the status of Chromecast device is received before notifying we have connected to it
     await Task.Delay(100);
     Client.Connected = true;
 }
Exemplo n.º 4
0
 public void OnMessageReceived(ChromecastSSLClientDataReceivedArgs e)
 {
     MessageReceived?.Invoke(this, e);
 }
Exemplo n.º 5
0
 private void YouTubeChannel_MessageReceived(object sender, ChromecastSSLClientDataReceivedArgs e)
 {
     var json = e.Message.PayloadUtf8;
     var response = JsonConvert.DeserializeObject<YouTubeSessionStatusResponse>(json);
     ScreenIdChanged?.Invoke(this, response.Data.ScreenId);
 }