The following tutorial discusses how to create a media manager and the associated overlays. It applies only to version 1.0.7.6 of StreetDeck and later.

A media manager is a media playback object used to play audio and video in StreetDeck. This media manager only implements audio playback. Playing back video is probably not possible yet as of version 1.0.7.6.

Getting Started
This tutorial will build upon the basic tutorial of Building a .Net Addin for StreetDeck. Please complete this project before continuing as this project will assume you are familiar with creating modules and overlays.

This tutorial will create a media manager that controls playback of windows media player. This is not a very practical example as StreetDeck already implements a media player media manager and this example contains more limited functionality then the one in StreetDeck. It is only used here for ease of demonstration. A better real world addin would be one for a specific internet radio application or Sirius radio.

Unlike some of the earlier tutorials, this tutorial will not walk you through creating a media manager, but rather explain the already created example to you. The easiest way to create a new media manager will simply take this example and modify it for your needs as thier is alot of events implemented that will be exactly the same for every media manager. Make sure you change GUID and Prog Ids when modifying the example.

To successfully build this addin, you will also need to have the Windows Media Player 10 SDK. Available here: http://download.microsoft.com/downlo...layer10sdk.exe Be sure and download the Media Player SDK, not the media format one.

This example will create a single module and a media manager in StreetDeck. The media manager will also automatically create 3 overlays that will be shown when the media manager is active. They can be accessed through the TrayOverlay, MediaControl, and ExtendedMediaControl properties of the media manager. The tray overlay is shown when the media manager becomes active and is never hidden. It usually contains the controls and album art that are shown in the lower left, but it is left up to you to create the controls you want on it. The media control overlay can be used to contain controls used for media playback and the extended media control overlay similarly should contain controls, but more advanced onces used less often. Implementing the media control overlays is recomended, but optional. You should always immplement the Tray overlay though and place on it the status information for the current media as well as a button linked to the eFunctionCurrentMediaOverlay function so that it can show the media control overlay and similarly, the media control overlay should contain a button to show the extended media control overlay. You should use the StreetDeck development enviornment to do this in the skin after you have created your addin and have it successfully running. Creating these controls is possible in code, but is much harder and is only necessary if you need to do some custom rendering, like rendering album art.

The primary module we create for this media manager will just contain a list that contains all media items found in the media player collection. Clicking on an item will load the media manager and play the item. After the item is playing, you will be able to control playback through the StreetDeck functions Next, Previous, Play, Pause, Volume Control, etc since the media manager will implement the event handling for it. You can create as many modules as you need to contain media selection.

Building your First Media Manager
This tutorial will also use the [Example 1 sdz] which contains the StreetDeck script project files. In addition to that you should download the corresponding Visual Studio 2003 C# example [here].

After opening the example project, you should set the output path of the project to My Documents\StreetDeck\Scripts\<Example 1 GUID>\Addins\ so that it builds to a StreetDeck.TestAddin.dll file in your script project directory. If you want to create a new project, you should use the StreetDeck development enviornment to do so, then just change the output path to point to the Addins subfolder of the script project.

After compiling the project, it should be fully functioning. You should be able to verify this by starting StreetDeck, goto DigitalMods, choose the example and it should list all the media in your media collection.

Now back to the code. This project has 4 classes and a form. Since the entire StreetDeck UI is rendered in Direct3D and is skinned, we should never show a windows form, however, to take advantage of the media player activeX control, we create a form called EmbeddedForm.cs and added the windows media player ActiveX control to. We never show the form, but we do access the control throughout the project.

Class1.cs is the simply the entry point of the addin. WMProject.cs contains all the code for the project. It creates the media manager and module for the project and handles the events for the one module we have. WMMediaManager.cs handles all the events for the media manager. This is where we respond to the next, previous, play events and return our current media state, volume, and other properties to StreetDeck. WMTrayOverlay.cs handles all events from the Tray overlay.

The code is well documented, you should read through it carefully to complete this tutorial.