Пример #1
0
        private async void Play_Playlist_Click(object sender, RoutedEventArgs e)
        {
            MediaPlayer.getInstance().stop();

            playlistBtn.IsEnabled = false;
            urlBox.IsEnabled      = false;
            urlLoading.IsActive   = true;

            try
            {
                // configure builder from json url
                MediaBuilder builder = new MediaBuilder();
                await builder.configureFromURLAsync(urlBox.Text);

                // play media units
                MediaPlayer.getInstance().playMediaUnits(await builder.mediaUnitsAsync());
            }
            catch
            {
                var dialog = new MessageDialog("Invalid url");
                var task   = dialog.ShowAsync();
            }

            urlLoading.IsActive = false;
            urlBox.IsEnabled    = true;
            if (!urlBox.Text.Equals(""))
            {
                playlistBtn.IsEnabled = true;
            }
        }
        private async void Play_Playlist_Click(object sender, RoutedEventArgs e)
        {
            MediaPlayer.getInstance().stop();

            playlistBtn.IsEnabled = false;
            urlBox.IsEnabled = false;
            urlLoading.IsActive = true;

            try
            {
                // configure builder from json url
                MediaBuilder builder = new MediaBuilder();
                await builder.configureFromURLAsync(urlBox.Text);

                // play media units
                MediaPlayer.getInstance().playMediaUnits(await builder.mediaUnitsAsync());
            }
            catch
            {
                var dialog = new MessageDialog("Invalid url");
                var task = dialog.ShowAsync();
            }

            urlLoading.IsActive = false;
            urlBox.IsEnabled = true;
            if (!urlBox.Text.Equals(""))
                playlistBtn.IsEnabled = true;
        }