Exemple #1
0
        private async void lstDeviceList_DoubleClick(object sender, EventArgs e)
        {
            var item = (SSDPResponse)lstDeviceList.SelectedItem;
            if (item != null && item.DeviceType == DeviceType.Chromecast)
            {
                var chromeCast = new ChromecastDevice(item);
                var info = await chromeCast.GetDetail();

                lblAddress.Text = info.IpAddress;
                lblName.Text = info.Name;

                groupChromecast.Enabled = true;
                ChromecastClient = new ChromecastClient(item.Address, 8009);
                btnLaunchYoutube.Enabled = true;
            }
        }
Exemple #2
0
        public virtual async Task StartDevice()
        {
            var chromeCastReport = Report as ChromecastDeviceDiscoveryReportItem;
            Device = new ChromecastDevice(chromeCastReport );
            Client = new ChromecastClient(chromeCastReport.EndPoint.Address, 8009);   // <-- dat port number :(

            ConnectionChannel = Client.CreateChannel(DialConstants.DialConnectionUrn);
            HeartbeatChannel = Client.CreateChannel(DialConstants.DialHeartbeatUrn);
            ReceiverChannel = Client.CreateChannel(DialConstants.DialReceiverUrn);
            MediaChannel = Client.CreateChannel(DialConstants.DialMediaUrn);

            await Client.Connect();
            Client.Listen();

            // Send the connect message
            Client.Write(MessageFactory.Connect());

            Client.StartHeartbeat();
        }