void UpdateState(MediaElementState state) { Debug.WriteLine("MediaElement State: " + state); if (MediaElementState.Buffering == state && null != mediaElement1) { MediaStateBox.Text = string.Format("Buffering {0:F2}%", mediaElement1.BufferingProgress * 100); } else { MediaStateBox.Text = state.ToString(); } if (MediaElementState.Closed == state) { playButton.IsEnabled = true; stopButton.IsEnabled = false; } else if (MediaElementState.Paused == state || MediaElementState.Stopped == state) { playButton.IsEnabled = true; stopButton.IsEnabled = true; } else { stopButton.IsEnabled = true; } OnPositionSamplerOnTick(null, null); }
public static void ChangePlayState(MediaElementState mediaState) { System.Diagnostics.Debug.WriteLine(mediaState.ToString()); var playPage = CommonUtils.GetCurrentPage() as PlayPage; if (playPage != null) { playPage.ChangePlayState(mediaState); } }
public static void ChangePlayState(MediaElementState mediaState) { System.Diagnostics.Debug.WriteLine(mediaState.ToString()); var playPage = CommonUtils.GetCurrentPage() as PlayPage; if (playPage != null) { playPage.ChangePlayState(mediaState); } }
public void UpdatePosition(PlaylistMgr Playlist, TimeSpan CurrentPosition, MediaElementState State) { if (_isUpdating) return; _isUpdating = true; int AvailableChunkCount = Playlist.AvailableChunkCount; _lastTotalPlayLength = Playlist.PlaylistDuration; ChunkSlider.AvailableChunkCount = AvailableChunkCount; ChunkSlider.ChunkDuration = Playlist.ChunkDuration; if (CurrentPosition == TimeSpan.Zero) { TimeTextBox.Text = "Loading"; } else { TimeTextBox.Text = State.ToString() + " " + FormatTimeSpan(CurrentPosition); ChunkSlider.UpdatePlayhead(Playlist, CurrentPosition); } _isUpdating = false; }
void UpdateState(MediaElementState state) { Debug.WriteLine("MediaElement State: " + state); if (MediaElementState.Buffering == state && null != mediaElement1) MediaStateBox.Text = string.Format("Buffering {0:F2}%", mediaElement1.BufferingProgress * 100); else MediaStateBox.Text = state.ToString(); var smtc = SystemMediaTransportControls.GetForCurrentView(); switch (state) { case MediaElementState.Closed: playButton.IsEnabled = true; stopButton.IsEnabled = false; smtc.PlaybackStatus = MediaPlaybackStatus.Closed; break; case MediaElementState.Paused: playButton.IsEnabled = true; stopButton.IsEnabled = true; smtc.PlaybackStatus = MediaPlaybackStatus.Paused; break; case MediaElementState.Playing: playButton.IsEnabled = false; stopButton.IsEnabled = true; smtc.PlaybackStatus = MediaPlaybackStatus.Playing; break; case MediaElementState.Stopped: playButton.IsEnabled = true; stopButton.IsEnabled = true; smtc.PlaybackStatus = MediaPlaybackStatus.Stopped; break; default: stopButton.IsEnabled = true; break; } if (null == mediaElement1) _wasFull = false; else { if (MediaElementState.Playing == state) { if (_wasFull) mediaElement1.IsFullWindow = true; } else { _wasFull = mediaElement1.IsFullWindow; if (_wasFull) mediaElement1.IsFullWindow = false; } } OnPositionSamplerOnTick(null, null); }
private static MediaPluginState ConvertToPlayState(MediaElementState mediaElementState) { return((MediaPluginState)Enum.Parse(typeof(MediaPluginState), mediaElementState.ToString(), true)); }
void UpdateState(MediaElementState state) { Debug.WriteLine("MediaElement State: " + state); if (MediaElementState.Buffering == state && null != mediaElement1) { MediaStateBox.Text = string.Format("Buffering {0:F2}%", mediaElement1.BufferingProgress * 100); } else { MediaStateBox.Text = state.ToString(); } var smtc = SystemMediaTransportControls.GetForCurrentView(); switch (state) { case MediaElementState.Closed: playButton.IsEnabled = true; stopButton.IsEnabled = false; smtc.PlaybackStatus = MediaPlaybackStatus.Closed; break; case MediaElementState.Paused: playButton.IsEnabled = true; stopButton.IsEnabled = true; smtc.PlaybackStatus = MediaPlaybackStatus.Paused; break; case MediaElementState.Playing: playButton.IsEnabled = false; stopButton.IsEnabled = true; smtc.PlaybackStatus = MediaPlaybackStatus.Playing; break; case MediaElementState.Stopped: playButton.IsEnabled = true; stopButton.IsEnabled = true; smtc.PlaybackStatus = MediaPlaybackStatus.Stopped; break; default: stopButton.IsEnabled = true; break; } if (null == mediaElement1) { _wasFull = false; } else { if (MediaElementState.Playing == state) { if (_wasFull) { mediaElement1.IsFullWindow = true; } } else { _wasFull = mediaElement1.IsFullWindow; if (_wasFull) { mediaElement1.IsFullWindow = false; } } } OnPositionSamplerOnTick(null, null); }
private static MediaPluginState ConvertToPlayState(MediaElementState mediaElementState) { return (MediaPluginState)Enum.Parse(typeof(MediaPluginState), mediaElementState.ToString(), true); }
void UpdateState(MediaElementState state) { Debug.WriteLine("MediaElement State: " + state); if (MediaElementState.Buffering == state && null != mediaElement1) MediaStateBox.Text = string.Format("Buffering {0:F2}%", mediaElement1.BufferingProgress * 100); else MediaStateBox.Text = state.ToString(); switch (state) { case MediaElementState.Closed: playButton.IsEnabled = true; stopButton.IsEnabled = false; break; case MediaElementState.Paused: playButton.IsEnabled = true; stopButton.IsEnabled = true; errorBox.Visibility = Visibility.Collapsed; break; case MediaElementState.Playing: playButton.IsEnabled = false; stopButton.IsEnabled = true; errorBox.Visibility = Visibility.Collapsed; break; default: stopButton.IsEnabled = true; errorBox.Visibility = Visibility.Collapsed; break; } OnPositionSamplerOnTick(null, null); }