SmoothStreamingElement config.xml

Jun 22, 2011 at 2:14 PM

Hi,

I'm trying to set the ConfigPath property on the SmoothStreamingMediaElement used within the SmoothStreamingMediaPlugin in the SMF. But it doesn't seem to work and I don't know why.

To set the configPath I wait for the OnMediaPluginLoaded event and when the SmoothStreamingMediaPlugin is loaded I get the SmoothStreamingMediaElement and set the ConfigPath property to config.xml which is an xml file inside my application.

This doesn't work, but if I create a new application and which contains just a SmoothStreamingMediaElement (not the SMFPlayer) and set the configPath in the same way it works.

 

I don't understand why this doesn't work when set within the SMFPlayer, but I my current guess at why is as follows: In the msdn notes for configPath property it says "Full trust for the immediate caller. This member cannot be used by partially trusted code". So it could be that because the SmoothStreamingMediaElement is a member of the SmoothStreamingMediaPlugin, the ConfigPath can only be set from within the SmoothStreamingMediaPlugin. Since only members of SmoothStreamingMediaPlugin are trusted code. But this is just a guess and if anyone can provide any further understanding or explanation, it would be much appreciated.

Thanks,

Michael

Coordinator
Jun 22, 2011 at 5:00 PM

Hi Michael, SMF already sets ConfigPath for you on the SSME. It is hardcoded to "Config.xml". So all you should need to do is make sure that file exists 1) in your main project 2) has Build Action  = Content

Here is a slightly modified snippet of the source code in the SmoothStreamingMediaPlugin...

        private void InitializeSmoothStreamingMediaElement()
         {
             if (MediaElement == null)
             { 
                MediaElement = new SmoothStreamingMediaElement(); 
#if !WINDOWS_PHONE
                 MediaElement.ConfigPath = "Config.xml";
 #endif 

Tim

Jun 23, 2011 at 10:45 AM

Hi Tim,

Thanks for the reply, this method works. But what I really want to do is to use a config file which is a resource in a class library assembly, not in the application package.

So I was wandering if the ConfigPath is hardcoded the first time it is set? Because although I can still set the ConfigPath Property in the method described in my first post, it doesn't seem to have any effect. For example if I add a file called config1.xml to my main project and set the ConfigPath to config1.xml then this doesn't work.

-Michael

Jun 23, 2011 at 3:44 PM

I'm curious what is in your config.xml? So far using the sample one's I've found before all I've accomplished is crashing the player using them. 

Jun 24, 2011 at 9:39 AM

I've only just found out about this option and it doesn't seem to be officially documented but this is the only forum post I can about it - http://forums.iis.net/t/1172146.aspx . I've tried a couple of options mentioned in the post and they seem to work.

Coordinator
Jul 19, 2011 at 4:54 PM

darthobiwan, I've been told that LiveBufferTimeMilliseconds has been removed from the config xml and is now a property of the SSME: http://msdn.microsoft.com/en-us/library/microsoft.web.media.smoothstreaming.smoothstreamingmediaelement.liveplaybackoffset(v=VS.90).aspx

If you are still having problems getting the player to accept a config.xml, please try removing this in the xml.

Jul 20, 2011 at 4:42 PM

... any chance there will ever be a MSDN page for config.xml?