NaturalGroundingPlayer.SetupWizard.DownloadAndPlaySample C# (CSharp) Method

DownloadAndPlaySample() public method

public DownloadAndPlaySample ( string artist, string title ) : Task
artist string
title string
return Task
        public async Task DownloadAndPlaySample(string artist, string title) {
            EditVideoBusiness FindVideoBusiness = new EditVideoBusiness();
            Media sample = FindVideoBusiness.GetVideoByTitle(MediaType.Video, artist, title);
            if (sample != null) {
                if (sample.FileName != null && File.Exists(Settings.NaturalGroundingFolder + sample.FileName)) {
                    // File exists, play.
                    await PlayVideo(sample);
                } else if (sample.DownloadUrl != null) {
                    // File doesn't exist, download.
                    // It will only auto-play if user is still on the same page.
                    downloadPage = currentPage;
                    await SessionCore.Instance.Business.DownloadManager.DownloadVideoAsync(sample, -1, DownloadBusiness_DownloadCompleted);
                }
            }
        }

Usage Example

        private async void Page_Loaded(object sender, RoutedEventArgs e) {
            owner = (SetupWizard)Window.GetWindow(this);

            MpcConfigBusiness.IsSvpEnabled = true;
            MpcConfigBusiness.IsMadvrEnabled = true;
            MpcConfigBusiness.IsWidescreenEnabled = false;
            await owner.DownloadAndPlaySample("Ellie Goulding", "Burn");
        }
All Usage Examples Of NaturalGroundingPlayer.SetupWizard::DownloadAndPlaySample