Rewind and Fast Forward using the Smooth Streaming Media Element (SSME) Beta 2
Hey Folks! Time ago I blogged about how to add the Slow Motion capability to your Smooth Streaming player by using the Smooth Streaming Media Element published by the IIS team.
Now it’s time to share with you how to provide the rewind and fast forward options to enable a real rich video experience.
Again, adding support for these features is easy, and if you understood what we did for providing the Slow Motion experience, then the following will be a piece of cake.
For rewind, the trick is getting all the playback rates under 0.0 and for fast forward, all the playback rates above 1.0.
Show me the code!
Rewind
/// <summary>/// Toogles the PlaybackRate of the Smooth Streaming Media Element./// Uses the PlaybackRates under 0.0 to support Rewind./// </summary>public void OnRewind(){// PlaybackRate index to set on the SSME.int newPlaybackRateIndex = 0;// Verify the state of the SmoothPlayerif (this.SmoothPlayer.CurrentState == SmoothStreamingMediaElementState.Paused|| this.SmoothPlayer.CurrentState == SmoothStreamingMediaElementState.Playing|| this.SmoothPlayer.CurrentState == SmoothStreamingMediaElementState.Buffering){// Get the current PlaybackRate of the SSMEdouble playbackRate = this.PlaybackRate;// The first time we get the Rewind PlaybackRates from// the SSME supported PlayBackRates. Rewind PlaybackRates// are under 0.0if (this.rewindPlaybackRates == null){this.rewindPlaybackRates = new List<double>();IList<double> supportedPlaybackRates = this.SmoothPlayer.SupportedPlaybackRates;for (int i = 0; i < supportedPlaybackRates.Count - 1; i++){if (supportedPlaybackRates[i] < 0.0){this.rewindPlaybackRates.Add(supportedPlaybackRates[i]);}}this.rewindPlaybackRates.Add(1.0);}// Verify if the current PlaybackRate is within the// allowables values. Get the index of the new// PlaybackRate to set.if (playbackRate >= 0.0){newPlaybackRateIndex = 0;}else{for (int i = 0; i < this.rewindPlaybackRates.Count - 1; i++){if (this.rewindPlaybackRates[i] == playbackRate){newPlaybackRateIndex = (i + 1) % this.rewindPlaybackRates.Count;break;}}}this.SmoothPlayer.SetPlaybackRate(this.rewindPlaybackRates[newPlaybackRateIndex]);}}
Fast Forward
/// <summary>/// Toogles the PlaybackRate of the Smooth Streaming Media Element./// Uses the PlaybackRates greather than 1.0 to support Fast forward./// </summary>public void OnFastForward(){// PlaybackRate index to set on the SSME.int newPlaybackRateIndex = 0;// Verify the state of the SmoothPlayerif (this.SmoothPlayer.CurrentState == SmoothStreamingMediaElementState.Paused|| this.SmoothPlayer.CurrentState == SmoothStreamingMediaElementState.Playing|| this.SmoothPlayer.CurrentState == SmoothStreamingMediaElementState.Buffering){// Get the current PlaybackRate of the SSMEdouble playbackRate = this.PlaybackRate;// The first time we get the Fast Forward PlaybackRates from// the SSME supported PlayBackRates. Fast Forward PlaybackRates// are above 1.0if (this.fastForwardPlaybackRates == null){this.fastForwardPlaybackRates = new List<double>();IList<double> supportedPlaybackRates = this.SmoothPlayer.SupportedPlaybackRates;for (int i = 0; i < supportedPlaybackRates.Count - 1; i++){if (supportedPlaybackRates[i] > 1.0){this.fastForwardPlaybackRates.Add(supportedPlaybackRates[i]);}}this.fastForwardPlaybackRates.Add(1.0);}// Verify if the current PlaybackRate is within the// allowables values. Get the index of the new// PlaybackRate to set.if (playbackRate <= 1.0){newPlaybackRateIndex = 0;}else{for (int i = 0; i < this.fastForwardPlaybackRates.Count - 1; i++){if (this.fastForwardPlaybackRates[i] == playbackRate){newPlaybackRateIndex = (i + 1) % this.fastForwardPlaybackRates.Count;break;}}}this.SmoothPlayer.SetPlaybackRate(this.fastForwardPlaybackRates[newPlaybackRateIndex]);}}
For more information about the SSME Beta 2 release, check Vishal’s post : IIS Smooth Streaming Player Development Kit Beta 2 released


client development technologies such as Silverlight. And in the last few weeks, I started to look to some of the new 
So, if we want to the start the LiveSmoothStream publishing point associated to the SmoothStreaming application from the Default Web Site, we should call the ExecuteRscaFunction method in this way:


