How to retrieve plugin instance into page

Feb 21, 2011 at 4:55 PM

how can I retrieve the instanced plugin into page (into the .cs linked to the .xaml file that contains the player) without extend the plugin?

Thanks and regards,

Feb 26, 2011 at 5:40 PM

Daniele, if it is the ActiveMediaPlugin that you are after, you can inherit SMFPlayer and access the protected property "ActiveMediaPlugin" to gain a reference to it. You could then expose this from your inherited class as it's own property (which could then be referenced by the code behind).

Something like...

public class MyPlayer: SMFPlayer{

public IMediaPlugin CurrentMediaPlugin{

    get { return base.ActiveMediaPlugin; }



Tim Greenfield

Mar 1, 2011 at 12:24 PM

Thank you very much for this trick; now I'm looking for a way to access the raw audio data...


Mar 1, 2011 at 4:42 PM

Daniele, if you are using adaptive streaming you can aquire info about the available audio streams via:

List<IMediaStream> audioStreams = ActiveAdaptiveMediaPlugin.CurrentSegment.AvailableStreams.Where(i => i.Type == StreamType.Audio).ToList();

To get the binary audio data however, I believe you will need to download the chunks yourself since I don't think the audio data is cached in memory. If you look at the source in SmoothStreamingMediaPlugin.SetSegmentSelectedStreams you can see how we download chunks in SMF.

Hope this helps,

Tim Greenfield

Mar 11, 2011 at 2:35 PM

Hi Tim,

I want to write a custom visual plugin. How would I get an instance of it from the player?


Mar 11, 2011 at 5:08 PM

Szymon, as of SMF 2.3, the PluginsManager property is now protected. Therefore you can subclass SMFPlayer and access all UI Plugins via: 

IEnumerable<IUIPlugin> plugins = PluginsManager.PresentationPlugins

.Where(i => !i.IsValueCreated)

.Select(i => i.Value);

- Tim Greenfield