Quick Tip: Accurate Seeks on the Smooth Streaming Media Element (SSME)

Yesterday, I exchanged some emails with my friend Chandler from iStreamPlanet. He was having some trouble with the Smooth Streaming Media Element (SSME). He described the issue as:

  • When I set the position on the Smooth Streaming Media Element, the displayed frame is not updated.
  • I can only get the frame displayed to update when playback is resumed.

The default behavior of the SSME doesn’t allow to seek inside fragment (chunks) boundaries, so if you seek to any position in within the same 2-seconds chunk of video, you always get the same frame displayed. The change to enable this is really simple, but is one of those hidden gems of the SSME.

The Smooth Streaming Media Element can be configured using an XML file in which you can set a wide range of settings. One of these settings is actually the one to enable accurate seeks on the SSME.

4 Steps to success

  1. In your Silverlight project, add an Xml file and named it config.xml. You add the file to the Silverlight project, because it needs to be part of the XAP package.
  2. Copy the following content into the file:
    <?xml version=”1.0″ encoding=”utf-8″ ?>
    <LiveSmoothStreamingSettings>
    ¬ <BufferingEngineSettings ForceAccurateSeeks=”true”/>
    </LiveSmoothStreamingSettings>
  3. Save the file.
  4. Add the following attribute in XAML for the SSME.
    e.g., <XYZ:SmoohtStreamingMediaElement ConfigPath=”config.xml”>

    Alternatively, you can set this programatically:

    this.ConfigPath = “Config.xml”;

Hope this helps.

Enjoy!

kick it on DotNetKicks.com
Shout it



2 Comments

  • Kapil says:

    Hello,

    How can I do it with SMF ( smf.cloudapp.net ) player?

    Thanks
    Kapil

    • Yannick Bessette says:

      Hello,

      This post is saved me a lot of time.

      Kapil, to answer your question, you can use the following in a custom class deriving from SMFPlayer:

      protected override void OnMediaOpened()
      {
      ((SmoothStreamingMediaElement)this.ActiveAdaptiveMediaPlugin.VisualElement ).ConfigPath = “config.xml”;
      }
      Hope this helps,
      Yannick

Leave a Reply