Using the .NET Windows Media Player library, I have been able to obtain and alter various file properties (like user rating) for Windows Media Player programmatically. I wish to use the same library to control (play, stop, next, etc.) a Windows Media Player instance through a Player.openPlayer(url)
call. In theory, this should be very possible through the Player.controls object, but none of the controls are available when I go to access them. Virtually all of the Player properties/methods/events are available to me except the controls object. Here is some sample code to illustrate what I've tried:
import clr
clr.AddReferenceToFile( "Interop.WMPLib.dll" )
from Interop.WMPLib import WindowsMediaPlayerClass
wmp = WindowsMediaPlayerClass()
wmp.openPlayer(r"C:\Users\Public\Music\Sample Music\Kalimba.mp3")
This works fine, but when I do the following:
print wmp.controls.isAvailable("play").ToString()
print wmp.controls.isAvailable("pause").ToString()
print wmp.controls.isAvailable("stop").ToString()
...
I get false for each control. Why are these controls not available to my (simple) application? Am I perhaps going about this the wrong way? I am using WMP 12, so it should be more than compatible. I would really prefer not to use another API, but I'm willing to try anything at this point.
Here is the documentation for reference: http://msdn.microsoft.com/en-us/library/dd564034%28v=vs.85%29.aspx
Edit: The quick fix is holding for now, but I still haven't found an actual solution yet.