Ejemplo n.º 1
0
        /// <summary>
        /// Play the track.
        /// </summary>
        /// <param name="track">The track to play.</param>
        public static Task Play(QueueTrack track)
        {
            string artists          = String.Empty;
            string url              = String.Empty;
            string embeddedVideoUrl = String.Empty;

            if (track.Artists != null)
            {
                artists = StringHelper.ArrayToString(track.Artists);
            }

            // If we have the Youtube ID we can construct the URL, otherwise
            // send a request to youtube API for the information.
            if (String.IsNullOrEmpty(track.YoutubeId))
            {
                url = YoutubeApi.SingleResultSearch(track.Name + artists);
            }
            else
            {
                url = "https://www.youtube.com/watch?v=" + track.YoutubeId;
            }

            embeddedVideoUrl = LibVideo.GetLink(url);

            SendAudioToVoice(embeddedVideoUrl);

            return(Task.CompletedTask);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Fires when the Delete button is clicked on a <see cref="QueueItem"/>.
        /// Removes the clicked <see cref="QueueItem"/> from the queue.
        /// </summary>
        private void QueueItem_DeleteButtonClick(object sender, EventArgs e)
        {
            QueueItem queueItem = (QueueItem)sender;

            QueueTrack track = (QueueTrack)queueItem.DataContext;

            viewModel.QueueViewModel.RemoveFromQueue(track);
        }
 public QueueChangedEventArgs(QueueTrack track)
 {
     Track = track;
 }