async Task ExecuteSearchCommand(string searchParameter) { if (string.IsNullOrEmpty(searchParameter)) { return; } IsBusy = true; try { Items.RemoveAll(n => true); var results = await YouTubeWebsite.SearchVideosAsync(searchParameter, 1); var distinctResults = results.DistinctBy(n => n.Author); foreach (var vid in distinctResults) { var channel = await YouTubeWebsite.GetVideoAuthorChannelAsync(vid.Id); Items.Add(channel); } } catch (Exception e) { Console.WriteLine(e.Message); } finally { IsBusy = false; } }
async Task ExecuteSearchCommand(string searchParameter) { if (string.IsNullOrEmpty(searchParameter)) { return; } IsBusy = true; try { Items.RemoveAll(n => true); var result = await YouTubeWebsite.SearchVideosAsync(searchParameter, 1); Items.AddRange(result); } catch (Exception e) { Console.WriteLine(e.Message); } finally { IsBusy = false; } }
public async Task PlayVideo(string videoId, ClosedCaption caption) { Caption = caption; var videoMedia = await YouTubeWebsite.GetVideoMediaStreamInfosAsync(videoId); var media = new Media(_libVLC, videoMedia.Muxed.WithHighestVideoQuality().Url, FromType.FromLocation); media.AddOption($":start-time={string.Format("{0:D2}.{1:D2}", (int)caption.Offset.TotalSeconds, caption.Offset.Milliseconds)}"); media.AddOption($":run-time={string.Format("{0:D2}.{1:D2}", (int)caption.Duration.TotalSeconds, caption.Duration.Milliseconds)}"); _mediaPlayer = new MediaPlayer(_libVLC); _videoView.MediaPlayer = _mediaPlayer; _mediaPlayer.Play(media); }
public async Task ExecuteLoadVideoList(bool refresh = false) { IsBusy = true; try { ChannelVideosPlaylist = await YouTubeWebsite.GetPlaylistAsync(Channel.GetChannelVideosPlaylistId(), 1); } catch (Exception e) { Console.WriteLine(e.Message); } finally { IsBusy = false; } }
public async Task ExecuteGetCaptionAsync() { IsBusy = true; try { Track = await YouTubeWebsite.GetClosedCaptionTrackAsync(trackInfo); AllCaptions = Track.Captions.ToList(); Captions = AllCaptions; } catch (Exception e) { Console.WriteLine(e.Message); } finally { IsBusy = false; } }
public async Task <IReadOnlyList <ClosedCaptionTrackInfo> > GetCaptions(string videoId) { return(await YouTubeWebsite.GetVideoClosedCaptionTrackInfosAsync(videoId)); }
public async Task <ClosedCaptionTrackInfo> TempGetCaptions(PlaylistItem item) { var captions = await YouTubeWebsite.GetVideoClosedCaptionTrackInfosAsync(item.Snippet.ResourceId.VideoId); return(captions.FirstOrDefault()); }