Esempio n. 1
0
        private async Task PopulateMarkersAsync(Video video)
        {
            var apiEndpoint = GetVideoMarkersEndpoint(video.Id);

            var request = CreateWebRequest(apiEndpoint, TwitchApiVersion.v5);

            var webResponse = await request.GetResponseAsync();

            KrakenMarkerResponse response;

            using (var reader = new StreamReader(webResponse.GetResponseStream()))
            {
                var readerOutput = reader.ReadToEnd();
                response = await Task.Factory.StartNew(() => JsonConvert.DeserializeObject <KrakenMarkerResponse>(readerOutput));
            }

            if (response.markers.game_changes == null)
            {
                return;
            }

            foreach (var marker in response.markers.game_changes)
            {
                video.AddMarker(Marker.Create(marker.label, marker.time));
            }
        }