how to get MediaElementId from SMFPlayer

May 24, 2012 at 11:52 PM
Edited May 25, 2012 at 12:46 AM


I have several SMFPlayer's in my app and on receiving LogReceived event raised by LoggingService, I need to know for which player the event happened.

The log classes have MediaElementId property but I don't know how to associate this id to the SMFPlayer's.

The MediaElementId's of the Log objects are in the form SSME_1, SSME_2, SSME_3,...

I have no idea where these id's come from and how to know which ones correspond to which SMFPlayer


Starting from a SMFPlayer how can I obtain the MediaElementId?


Thank you,

May 25, 2012 at 12:21 AM
Edited May 25, 2012 at 12:46 AM


Jun 1, 2012 at 11:12 PM

You can have a separate config file per instance of SMFPlayer...

                <Utilities:MetadataItem Key="Microsoft.SilverlightMediaFramework.Logging.ConfigUri" Value="MonitoringConfig1.xml" />

Then, in the config xml, you can add a key value pair to attach extra info to each log from that player:


There's also a programmatic way to accomplish the same thing:

var diagPlugin = ((IPlayer)smfPlayer).Plugins.OfType<DiagnosticsPlugin>().FirstOrDefault();
var smfLogger = diagPlugin.Monitor;
smfLogger.AdditionalLogData["VideoId"] = "someID";