Ejemplo n.º 1
0
        public static async Task <SharpCasterDemoController> LaunchSharpCaster(this ChromeCastClient client)
        {
            var controller = new SharpCasterDemoController(client);
            await controller.LaunchApplication();

            return(controller);
        }
Ejemplo n.º 2
0
 private async void ChromeCastClient_Connected(object sender, EventArgs e)
 {
     if (_controller == null)
     {
         _controller = await ChromecastService.ChromeCastClient.LaunchSharpCaster();
     }
 }
Ejemplo n.º 3
0
 private static async void ChromeCastClient_Connected(object sender, EventArgs e)
 {
     System.Console.WriteLine("Connected to chromecast");
     if (_controller == null)
     {
         _controller = await ChromecastService.ChromeCastClient.LaunchSharpCaster();
     }
 }
Ejemplo n.º 4
0
 private async void ChromeCastClient_Connected(object sender, EventArgs e)
 {
     await ExecuteOnUiThread(() =>
     {
         ConnectedToChromecast = true;
     });
     _controller = await _chromecastService.ChromeCastClient.LaunchSharpCaster();
 }
Ejemplo n.º 5
0
 private void ConnectedChanged(object sender, EventArgs e)
 {
     DispatcherHelper.CheckBeginInvokeOnUI(async() =>
     {
         _controller            = await _chromecastService.ChromeCastClient.LaunchSharpCaster();
         ConnectingToChromecast = false;
         ConnectedToChromecast  = _chromecastService.ChromeCastClient.Connected;
     });
 }
Ejemplo n.º 6
0
        private async void ChromeCastClient_ApplicationStarted(object sender, ChromecastApplication e)
        {
            if (controller == null)
            {
                controller = await ChromecastService.ChromeCastClient.LaunchSharpCaster();
            }
            applicationStarted = true;
            if (connectToUrl != "")
            {
                await controller.LoadMedia(connectToUrl, "video/mp4", null, "BUFFERED", 0D, null, null, null, true, timeStamp);

                mediaLoaded();
            }
        }
Ejemplo n.º 7
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);
                ChromecastService.ConnectToChromecast(firstChromecast);
                await Task.Delay(5000);

                _controller = await ChromecastService.ChromeCastClient.LaunchSharpCaster();

                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, new[] { track }, new[] { 100 });
            }
        }
        private async void ChromeCastClient_ApplicationStarted(object sender, Models.ChromecastStatus.ChromecastApplication e)
        {
            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"
            };

            if (_controller == null)
            {
                _controller = await ChromecastService.ChromeCastClient.LaunchSharpCaster();
            }

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