Slow Motion using the Smooth Streaming Media Element (SSME)
The week started with really great news from the IIS Team. The IIS Media Services 3.0 streaming was released. Among others features the release includes the RTW bits of Live Smooth Streaming.
Also, in the efforts to bring the Smooth Streaming experience to everyone the IIS team published the IIS Smooth Streaming Player Development Kit 1.0 – Beta 1 which is intended to aid the development of rich Smooth Streaming experiences.
Bunch of posts to review if you are not aware of the new releases:
- IIS Media Services 3.0, including IIS Live Smooth Streaming, has been released – Chris Knowlton
- RTW of Live Smooth Streaming is now… Live. – John Bocharov
- IIS Media Services 3.0 and Player SDK released! – Alex Zambelli
- IIS Smooth Streaming Player Development Kit 1.0 – Beta 1 Released – Vishal Sood
I’m very excited with this release, as we have been using the Smooth Streaming Media Element almost from its beginning mainly for the work we did for the NBC Sunday Night Football event. (see here & here). I will start sharing with you how to take advantage of the SSME.
In this post I will show you how easy is to bring an Slow Motion experience using the SSME. Vishal blogged a great SSME getting started guide that I encourage you to review before digging into the details of this post.
Adding support for Slow Motion to your Smooth Player is really easy, and basically what you have to do is getting the playback rates between 0.0 and 1.0, and move across them every time you click your Slow Motion button on the player.
Below you will find a code snippet ready to be used that will help you to implement the Slow Motion logic.
private List<double> slowMotionPlaybackRates;/// <summary>/// Toogles the PlaybackRate of the Smooth Streaming Media Element./// Uses the PlaybackRates between 0.0 and 1.0 to support Slow Motion./// </summary>public void OnSlowMotion(){// PlaybackRate index to set on the SSME.int newPlaybackRateIndex = 0;// Verify the state of the SmoothPlayerif (this.SmoothPlayer.CurrentState == MediaElementState.Paused|| this.SmoothPlayer.CurrentState == MediaElementState.Playing|| this.SmoothPlayer.CurrentState == MediaElementState.Buffering){// Get the current PlaybackRate of the SSMEdouble playbackRate = this.SmoothPlayer.PlaybackRate;// The first time we get the SlowMotion PlaybackRates from// the SSME supported PlayBackRates. SlowMotion PlaybackRates// are between 0.0 and 1.0.if (this.slowMotionPlaybackRates == null){this.slowMotionPlaybackRates = new List<double>();IList<double> supportedPlaybackRates = this.SmoothPlayer.SupportedPlaybackRates;for (int i = 0; i < supportedPlaybackRates.Count; i++){if (supportedPlaybackRates[i] > 0.0 && supportedPlaybackRates[i] < 1.0){this.slowMotionPlaybackRates.Add(supportedPlaybackRates[i]);}}this.slowMotionPlaybackRates.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 || playbackRate >= 1.0){newPlaybackRateIndex = 0;}else{for (int i = 0; i < this.slowMotionPlaybackRates.Count; i++){if (this.slowMotionPlaybackRates[i] == playbackRate){newPlaybackRateIndex = (i + 1) % this.slowMotionPlaybackRates.Count;break;}}}this.SmoothPlayer.SetPlaybackRate(this.slowMotionPlaybackRates[newPlaybackRateIndex]);}}
Hope you find the code snippet useful. Stay tuned!, new posts are coming.
PS: If you face any issue with the Smooth Streaming Development Kit or if you just want to provide feedback to the IIS team, please use this thread.
Slow Motion using the Smooth Streaming Media Element (SSME) …
You’ve been kicked (a good thing) - Trackback from DotNetKicks.com…
Ezequiel Jadib’s Blog » Slow Motion using the Smooth Streaming Media Element (SSME)…
Thank you for submitting this cool story - Trackback from DotNetShoutout…
[...] the original: Slow Motion using the Smooth Streaming Media Element (SSME) By admin | category: Review? | tags: development, great-news, iis, media, media-services, [...]
[...] Folks! Days 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 [...]
Web casting, or broadcasting over the internet, is a media file (audio-video mostly) distributed over the internet using streaming media technology. Streaming implies media played as a continuous stream and received real time by the browser (end user). Streaming technology enables a single content source to be distributed to many simultaneous viewers. Streaming video bandwidth is typically calculated in gigabytes of data transferred. It is important to estimate how many viewers you can reach, for example in a live webcast, given your bandwidth constraints or conversely, if you are expecting a certain audience size, what bandwidth resources you need to deploy.
[...] 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 [...]
Very nice Blog, I will tell my friends about it.
Thanks