Exemplo n.º 1
0
 public MediaData(string url, string contentType, IMetadata metadata = null, string streamType = "BUFFERED", double duration = 0d, object customData = null, Track[] tracks = null)
 {
     Url = url;
     ContentType = contentType;
     StreamType = streamType;
     Duration = duration;
     Metadata = metadata;
     CustomData = customData;
     Tracks = tracks;
 }
 public async Task LoadMedia(
     string mediaUrl,
     string contentType = "application/vnd.ms-sstr+xml",
     IMetadata metadata = null,
     string streamType = "BUFFERED",
     double duration = 0D,
     object customData = null,
     Track[] tracks = null,
     int[] activeTrackIds = null,
     bool autoPlay = true,
     double currentTime = 0.0)
 {
     await
         Client.MediaChannel.LoadMedia(mediaUrl, contentType, metadata, streamType, duration, customData, tracks,
             activeTrackIds, autoPlay, currentTime);
 }
Exemplo n.º 3
0
        public async Task LoadMedia(
            string mediaUrl,
            string contentType = "application/vnd.ms-sstr+xml",
            IMetadata metadata = null,
            string streamType = "BUFFERED",
            double duration = 0D,
            object customData = null,
            Track[] tracks = null,
            int[] activeTrackIds = null,
            bool autoPlay = true,
            double currentTime = 0.0)
        {
            var mediaObject = new MediaData(mediaUrl, contentType, metadata, streamType, duration, customData, tracks);
            var req = new LoadRequest(Client.CurrentApplicationSessionId, mediaObject, autoPlay, currentTime, customData, activeTrackIds);

            var reqJson = req.ToJson();
            await Write(MessageFactory.Load(Client.CurrentApplicationTransportId, reqJson));
        }
Exemplo n.º 4
0
        private static async void Client_ApplicationStarted(object sender, ChromecastApplication e)
        {
            System.Console.WriteLine($"Application {e.DisplayName} has launched");
            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 });
        }
Exemplo n.º 5
0
        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 });

        }
Exemplo n.º 6
0
 public async Task LoadMedia(string title, string description, ImageSource poster)
 {
     Title = title;
     Description = description;
     Poster = poster;
     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"
     };
     await _controller.LoadMedia("https://commondatastorage.googleapis.com/gtv-videos-bucket/CastVideos/mp4/DesigningForGoogleCast.mp4", "video/mp4", null, "BUFFERED", 0D, null, new[] { track }, new[] { 100 });
 }