Example #1
0
        private void OnFetchVideoData(object sender, RoutedEventArgs e)
        {
            MediaItem item = (sender as Button).DataContext as MediaItem;

            if (item != null) // Get item as button data context
            {                 // Start asynchronous data download with callbacks
                YouTubeUtil.DownloadAudioAsync(item, null, OnDownloadProgressChanged, OnDownloadCompleted);
            }
            else
            {
                Debug.Log("INTERNAL ERROR: Button context is not a MediaItem!");
            }
        }
Example #2
0
        private void ContinueMassDownloadAudio()
        {
            if (!startedMassDownload)
            {
                return;
            }

            while (curMediaList.Count(m => m.isDownloading) < 5)
            {
                // Try to fetch next music item to download
                MediaItem nextItem = curMediaList.FirstOrDefault(m => !m.isDownloaded && !m.isDownloading);

                if (nextItem == null)
                {                 // Finished initiating mass downloads (still some downloading)
                    startedMassDownload = false;
                    break;
                }

                // Start task to populate all media items with additional video information
                YouTubeUtil.DownloadAudioAsync(nextItem, null, OnDownloadProgressChanged, OnDownloadCompleted);
            }
        }