Esempio n. 1
0
        public static async Task <WebController> LaunchWeb(this ChromeCastClient client)
        {
            client.MakeSureChannelExist(new WebChannel(client));
            var controller = new WebController(client);
            await controller.LaunchApplication();

            return(controller);
        }
Esempio n. 2
0
        private async static void ChromeCastClient_MediaStatusChanged(object sender, MediaStatus e)
        {
            if (e.PlayerState == PlayerState.Playing)
            {
                await Task.Delay(2000);

                await ChromecastService.ChromeCastClient.DisconnectChromecast();

                _controller = null;
                await Task.Delay(5000);

                var devices = await ChromecastService.StartLocatingDevices();

                if (devices.Count == 0)
                {
                    System.Console.WriteLine("No chromecasts found");
                    return;
                }

                var firstChromecast = devices.First();
                System.Console.WriteLine("Device found " + firstChromecast.FriendlyName);
                await ChromecastService.ConnectToChromecast(firstChromecast);

                await Task.Delay(5000);

                _controller = await ChromecastService.ChromeCastClient.LaunchWeb();

                await Task.Delay(4000);

                var track = new Track
                {
                    Name           = "English Subtitle",
                    TrackId        = 100,
                    Type           = "TEXT",
                    SubType        = "captions",
                    Language       = "en-US",
                    TrackContentId =
                        "https://commondatastorage.googleapis.com/gtv-videos-bucket/CastVideos/tracks/DesigningForGoogleCast-en.vtt"
                };
                while (_controller == null)
                {
                    await Task.Delay(500);
                }

                //await _controller.LoadMedia("https://commondatastorage.googleapis.com/gtv-videos-bucket/CastVideos/mp4/DesigningForGoogleCast.mp4", "video/mp4", null, "BUFFERED", 0D, null, ew[] { track }, new[] { 100 });
            }
        }