Expression Media Encoder – The code behind

Just been learning some new things about the Expression Media Encoder templates as I go through and re-skin them for various projects. Need to jot it all down before I forget.

The templates use Control Templates so the code for a User Control exists in only one place. But this makes the structure of the code a little unusual. Elements within the control are brought into the script by a class called GetTemplateChild

m_toolsButton = GetTemplateChild(ToolsButton) as ToggleButton;

Without this you can’t access elements in the Control Template. Thankfully most of the elements have been exposed already. However I couldn’t pick out at what point these elements get exposed.

For the media element you can add a PlaylistItem at any point so you don’t need to worry about accessing the media element’s source.

ExpressionMediaPlayer.PlaylistItem item = new ExpressionMediaPlayer.PlaylistItem()
{
     MediaSource = new Uri(VideoSource),
     Description = "blah",
     IsAdaptiveStreaming=false
};
myPlayer.Playlist.Items.Add(item);
Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: