/// <summary> /// Sets the content on the MediaPlayers /// </summary> private void Load_Click(object sender, RoutedEventArgs e) { EnablePlaybackControls(false); // First reset some app logic. timelineController.Pause(); maxNaturalDurationForController = TimeSpan.Zero; openedMediaCount = 0; foreach (MediaPlayerElement mpe in mediaPlayerElements) { MainPage.CleanUpMediaPlayerSource(mpe.MediaPlayer); } timelineController.Position = TimeSpan.Zero; // Apply any requested for offset between two videos. // Do this before setting the Source on the MediaPlayer to avoid a visible seek on MediaOpened. double d = 0.0; if (Double.TryParse(mpeCopyOffset.Text, out d)) { mpeCopy.MediaPlayer.TimelineControllerPositionOffset = TimeSpan.FromSeconds(d); } else { mpeCopy.MediaPlayer.TimelineControllerPositionOffset = TimeSpan.Zero; mpeCopyOffset.Text = "0.0"; } // Set the sources. For this demonstration, we play audio only from the first video. Uri uri; if (!Uri.TryCreate(mpeMainUri.Text, UriKind.Absolute, out uri)) { rootPage.NotifyUser("Invalid URI for first source.", NotifyType.ErrorMessage); return; } mpeMain.MediaPlayer.Source = MediaSource.CreateFromUri(uri); mpeMain.MediaPlayer.IsMuted = false; if (!Uri.TryCreate(mpeCopyUri.Text, UriKind.Absolute, out uri)) { rootPage.NotifyUser("Invalid URI for second source.", NotifyType.ErrorMessage); return; } mpeCopy.MediaPlayer.Source = MediaSource.CreateFromUri(uri); mpeMain.MediaPlayer.IsMuted = true; // Enable our custom playback controls now that everything is set up. EnablePlaybackControls(true); }