private async Task Play(SceneData sceneData) { foreach (var mediaSet in sceneData.MediaActionSets) { while (mediaActionPlayer != null && mediaActionPlayer.IsPlaying) { await Task.Delay(500); } try { if (mediaActionPlayer == null) { mediaActionPlayer = new MediaActionPlayer(mediaPlayerElement, mediaSet.MediaActions, Dispatcher, MediaActionPlayer.MediaActionPlayerType.Server); } else { mediaActionPlayer.ResetMediaAction(mediaSet.MediaActions); } mediaPlayerElement.Source = mediaSet.MovieMediaSource; mediaActionPlayer.Play(); } catch (Exception ex) { var dlg = new MessageDialog(ex.Message, ex.ToString()); await dlg.ShowAsync(); } } await Play(sceneData); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); btClient.Initialize(); //フルスクリーンに Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().TryEnterFullScreenMode(); var mediaSet = sceneData.MediaActionSets[0]; while (mediaActionPlayer != null && mediaActionPlayer.IsPlaying) { await Task.Delay(500); } try { if (mediaActionPlayer == null) { mediaActionPlayer = new MediaActionPlayer(mediaPlayerElement, mediaSet.MediaActions, Dispatcher, MediaActionPlayer.MediaActionPlayerType.Client);//ほんとはViewModel実装してDispatcherをなくしたい。。。 } else { currentScene = mediaSet.MediaActions[0].MediaScene; mediaActionPlayer.ResetMediaAction(mediaSet.MediaActions); } mediaPlayerElement.Source = mediaSet.MovieMediaSource; mediaActionPlayer.Play(); } catch (Exception ex) { var dlg = new MessageDialog(ex.Message, ex.ToString()); await dlg.ShowAsync(); } }