Controlling Windows Media Player from Java application
843810Mar 31 2009 — edited Apr 1 2009I'm enhancing a pre-existing Java application that runs on an XP box broadcasting audio and visual content to a small local network of TVs. The visual and some audio content comes from the Java app, but users can also use Windows Media Player to play background music (via CDs, local music files, whatever).
My goal is to modify the Java application such that, when it has some audio content to play, it mutes WMP. Unfortunately, I'm having a hard time figuring out how to make it happen. I gather that I'm going to need a Java-to-COM/ActiveX bridge, but it's not clear to me what package I should be using (Jacob?) or how I need to be using it. I'm also unclear on what corner of Microsoft's documentation for WMP's ActiveX API is most applicable to what I'm trying to do, since (not surprisingly) they don't provide any explicit support for Java. Does anybody have any advice or recommendations on how to proceed?
Also, how much of a headache will it be for the Java application to take control of a completely separate application? If WMP is running, it will have been started by the user, not the Java app. Are there any particular gotchas I should be watching out for?
Finally, if you know of some non-Java-based solution that makes this problem ridiculously easy to solve, I'd love to hear it. I'm not above having the application fire-off a command line script that can read and tweak WMP's volume. (Regrettably, the use of WMP is non-negotiable. Legacy systems are a pain that way.)
My thanks in advance for any help or insight anybody has to offer.
-- Pete