public void SeekCompleted(PlayerStatus NewStatus) { }
public void StatusUpdate(PlayerStatus NewStatus) { if (timeSlider != null) { timeSlider.SliderProgress = NewStatus.PlayProgress; timeSlider.BufferProgress = NewStatus.BufferingProgress; } switch (NewStatus.CurrentPlayState) { case SmoothStreamingMediaElementState.Playing: ShowPauseButton(); break; default: ShowPlayButton(); break; } }
public void PlayStateChanged(PlayerStatus NewStatus) { }
public void StatusUpdate(PlayerStatus NewStatus) { }
/// <summary> /// Update the 'Status' property with the most recently available values. /// </summary> private void RefreshStatus() { var new_status = new PlayerStatus(); if (!PosterMode) { if (CurrentItem != null) { if (!SmoothstreamBeginVariablesSet && CurrentItem.IsAdaptiveStreaming && MediaPlayer.CurrentState == SmoothStreamingMediaElementState.Playing) { SmoothstreamBeginVariablesSet = true; MediaPlayer.Position = TimeSpan.FromSeconds(Math.Max(CurrentItem.ResumePosition, CurrentItem.StartPosition)); } new_status.ClipEnd = (CurrentItem.StopPosition > CurrentItem.StartPosition) ? (TimeSpan.FromSeconds(CurrentItem.StopPosition)) : (MediaPlayer.EndPosition); new_status.ClipStart = TimeSpan.FromSeconds(Math.Max(CurrentItem.StartPosition, MediaPlayer.StartPosition.TotalSeconds)); new_status.CurrentPlayState = MediaPlayer.CurrentState; new_status.NaturalDuration = BestDuration(); new_status.PlaylistItemIndex = CurrentIndex; new_status.PlayTime = MediaPlayer.Position; new_status.BufferingProgress = MediaPlayer.BufferingProgress; try { if (IsLive) { new_status.ClipEnd = MediaPlayer.EndPosition; new_status.ClipStart = MediaPlayer.StartPosition; } new_status.NaturalStartPosition = TimeSpan.FromSeconds((IsLive) ? (MediaPlayer.LivePosition) : (Math.Max(CurrentItem.StartPosition, 0))); } catch { new_status.NaturalStartPosition = TimeSpan.Zero; } new_status.IsLive = IsLive; new_status.ClipDuration = ClipDuration(); new_status.PlayProgress = GetProportion(Status); } else { new_status.ClipEnd = TimeSpan.Zero; new_status.ClipStart = TimeSpan.Zero; new_status.CurrentPlayState = SmoothStreamingMediaElementState.Stopped; new_status.NaturalDuration = TimeSpan.Zero; new_status.PlaylistItemIndex = CurrentIndex; // helpful during poster mode. new_status.PlayTime = TimeSpan.Zero; new_status.BufferingProgress = 0.0; new_status.NaturalStartPosition = TimeSpan.Zero; new_status.IsLive = false; new_status.ClipDuration = TimeSpan.Zero; new_status.PlayProgress = 0.0; } } else { new_status.ClipEnd = TimeSpan.Zero; new_status.ClipStart = TimeSpan.Zero; new_status.CurrentPlayState = SmoothStreamingMediaElementState.Buffering; new_status.NaturalDuration = TimeSpan.Zero; new_status.PlaylistItemIndex = CurrentIndex; // helpful during poster mode. new_status.PlayTime = TimeSpan.Zero; new_status.BufferingProgress = 0.0; new_status.NaturalStartPosition = TimeSpan.Zero; new_status.IsLive = false; new_status.ClipDuration = TimeSpan.Zero; new_status.PlayProgress = 0.0; } Status = new_status; }
public void PlayStateChanged(PlayerStatus NewStatus) { lastStatus = NewStatus; BindActiveStates(); }
public void PlayStateChanged(PlayerStatus NewStatus) { var oldState = jwState(lastState.CurrentPlayState); var newState = jwState(NewStatus.CurrentPlayState); lastState = NewStatus; FireJwEvent("jwplayerPlayerState", "{oldstate:\"" + oldState + "\", newstate:\"" + newState + "\"}"); }
/// <summary> /// Cross-load playlist settings and start if AutoStart is set. /// </summary> private void PreparePlaylist() { Status = new PlayerStatus(); // reset status if (CurrentPlaylist == null) return; MediaPlayer.Stretch = CurrentPlaylist.StretchMode; Poster.Stretch = CurrentPlaylist.StretchMode; MediaPlayer.CacheMode = (CurrentPlaylist.EnableCachedComposition && (MediaPlayer.CacheMode == null)) ? new BitmapCache() : null; if (CurrentPlaylist.StartMuted) MediaPlayer.Volume = 0.0; if (CurrentPlaylist.Items.Count < 1) return; MediaPlayer.AutoPlay = CurrentPlaylist.AutoPlay; InPlayMode = CurrentPlaylist.AutoPlay; if (CurrentPlaylist.AutoLoad || CurrentPlaylist.AutoPlay) { GoToPlaylistIndex(0); } else { DisplayPoster(0); ResumeTime = TimeSpan.FromSeconds(Math.Max(CurrentItem.ResumePosition, CurrentItem.StartPosition)); ShouldSeek = true; // go to start point once the user decides to start. } foreach (var ctrl in ControlSets) { try { ctrl.PlaylistChanged(CurrentPlaylist); } catch (Exception e) {drop(e);} } }
/// <summary> /// Sends a 'stop' message to all connected controls. /// </summary> /// <remarks>At all other times, the play state should either be 'paused' or 'closed'</remarks> protected void ExitHandler(object sender, EventArgs e) { if (Status.PlaylistItemIndex < 0 && Status.CurrentPlayState == SmoothStreamingMediaElementState.Stopped) return; // no need to signal. var new_status = new PlayerStatus{ ClipEnd = TimeSpan.Zero, ClipStart = TimeSpan.Zero, CurrentPlayState = SmoothStreamingMediaElementState.Stopped, NaturalDuration = TimeSpan.Zero, PlaylistItemIndex = -1, PlayTime = TimeSpan.Zero, BufferingProgress = 0.0, NaturalStartPosition = TimeSpan.Zero, IsLive = false, ClipDuration = TimeSpan.Zero, PlayProgress = 0.0 }; Status = new_status; SendToControls(c => c.PlayStateChanged(Status)); }
private static double GetProportion(PlayerStatus NewStatus) { TimeSpan min = NewStatus.ClipStart; TimeSpan max = NewStatus.ClipEnd; if (NewStatus.NaturalDuration.HasTimeSpan) { if (max <= TimeSpan.Zero || max < min) max = NewStatus.NaturalDuration.TimeSpan; } double range = max.TotalSeconds - min.TotalSeconds; double loc = NewStatus.PlayTime.TotalSeconds - min.TotalSeconds; if (loc <= 0.0) return 0.0; if (range <= 0.0) return 0.0; if (loc > range) return 1.0; return loc / range; }
public void StatusUpdate(PlayerStatus NewStatus) { BackgroundIcon.Visibility = Visibility.Collapsed; PlayIcon.Visibility = Visibility.Collapsed; MuteIcon.Visibility = Visibility.Collapsed; BufferIcon.Visibility = Visibility.Collapsed; switch (NewStatus.CurrentPlayState) { case SmoothStreamingMediaElementState.Playing: break; case SmoothStreamingMediaElementState.Paused: case SmoothStreamingMediaElementState.Closed: case SmoothStreamingMediaElementState.Stopped: PlayIcon.Visibility = Visibility.Visible; BackgroundIcon.Visibility = Visibility.Visible; break; default: BufferIcon.Visibility = Visibility.Visible; BackgroundIcon.Visibility = Visibility.Visible; break; } if (BufferIcon.Visibility == Visibility.Visible) { if(spinAnimation != null) spinAnimation.Start(); } else { if (spinAnimation != null) spinAnimation.Stop(); } }
public void StatusUpdate(PlayerStatus NewStatus) { if (jwState(lastState.CurrentPlayState) == "PLAYING") { FireJwEvent("jwplayerMediaTime", "{duration: " + NewStatus.NaturalDuration.TimeSpan.TotalSeconds + //", offset: " + NewStatus.PlayTime.TotalSeconds + // todo: this should be last seek target (regardless of actual seek position) ", position: " + NewStatus.PlayTime.TotalSeconds + "}"); } lastState = NewStatus; }
public void SeekCompleted(PlayerStatus NewStatus) { FireJwEvent("jwplayerMediaSeek", "{position:" + lastState.PlayTime.TotalSeconds + ", offset:" + NewStatus.PlayTime.TotalSeconds + "}"); lastState = NewStatus; }
public void StatusUpdate(PlayerStatus NewStatus) { DurationTime.Text = NewStatus.ClipDuration.TimeSpan.Minutes.ToString("00") + ":" + NewStatus.ClipDuration.TimeSpan.Seconds.ToString("00"); }
public void StatusUpdate(PlayerStatus NewStatus) { CaptionsButton.Visibility = HasCaptions(NewStatus) ? Visibility.Visible : Visibility.Collapsed; }
public void StatusUpdate(PlayerStatus NewStatus) { ScrollSlider.TotalHeight = PlaylistItemStack.ActualHeight; ScrollSlider.VisibleHeight = LayoutRoot.ActualHeight; if (ScrollSlider.TotalHeight <= ScrollSlider.VisibleHeight) ScrollSlider.Visibility = Visibility.Collapsed; else ScrollSlider.Visibility = Visibility.Visible; }
bool HasCaptions(PlayerStatus NewStatus) { if (lastPlaylist == null) return false; if (lastPlaylist.Items[NewStatus.PlaylistItemIndex].CaptionItems == null) return false; return lastPlaylist.Items[NewStatus.PlaylistItemIndex].CaptionItems.Count > 0; }
public void SeekCompleted(PlayerStatus NewStatus) { lastStatus = NewStatus; BindActiveStates(); }
public void StatusUpdate(PlayerStatus NewStatus) { ElapsedTime.Text = NewStatus.PlayTime.Minutes.ToString("00")+":"+NewStatus.PlayTime.Seconds.ToString("00"); }