how to get MediaElementId from SMFPlayer

May 24, 2012 at 10:52 PM
Edited May 24, 2012 at 11:46 PM


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 24, 2012 at 11:21 PM
Edited May 24, 2012 at 11:46 PM


Jun 1, 2012 at 10: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";