Media Player 10 is the first device version to have an automation model. Previous versions could be controlled via some undocumented windows messages but that was about it. The Media Player 10 Mobile object model is COM based, so you can’t use it directly from .NETCF v1.0. I set about creating a wrapper months ago but it got left due to lack of time. However I’ve decided there is enough functionality available in it now for it to function. I’ve not had time to create a sample application, so your challenge if you choose to accept it (and I’ll be honest there isn’t a prize!) is to create something using the assembly.
Because theres no support for hooking com events with a sink interface the wrapper exposes no events, also because there isn’t ActiveX hosting support you won’t get any UI – so this is useful for audio content only. The other big limitation is that you must have Media Player 10 on your device.
Other than that feel free to have a play and see what fun you can have with it, any issues suggestions or cool creations you build with it please drop me an email or post a comment.
2 replies on “The great Media Player 10 Automation Challenge!”
I downloaded the library and I must say, it is very good. However I have a problem; the trigger for playing my MP3 files comes from a background thread, and I could get no output from the media player unless I call the library from the UI thread. So I am invoking a call on the UI thread to play my files, and that all works fine. But when I try to shut down the application, it hangs while disposing the media player. Should I post my code and see what might be going on?
I try to use your library on WM 5.0 pocket pc emulator and Exception are raised.
This is a piece of code that I have made using your dll :
Player player = new Player();
MediaCollection collection = player.MediaCollection;
Playlist playlist = collection.GetAll();
Controls controls = player.Controls;
if (playlist.Count > 0)
Media media = playlist;
controls.PlayItem(media); // An exception occurs here.
The exception message is "The parameter is incorrect.
I have run the app in debugging mode and I watch parameters inside "media" and everything looks fine apparently (sourceurl contains the path of an audio file)
Can you tell me my code is incorrect ?