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
- 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.
- Copy the following content into the file:
<?xml version=”1.0″ encoding=”utf-8″ ?>
¬ <BufferingEngineSettings ForceAccurateSeeks=”true”/>
- Save the file.
- 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.