Programmatically Controlling Windows Media Player, Preferably From Java
Asked Answered
C

1

2

I'm adding functionality to an existing Java application that's already been deployed extensively. (So there are some design decisions that I can't touch unless I have a seriously compelling reason.) The app controls a PC broadcasting audio and visual to a small local TV network. Right now, it mostly broadcasts static slides, but it can also do background music at the client's discretion. The background music (CD, local music files, internet radio, whatever) is handled by Windows Media Player.

My current project is adding narration to the static slides. When the narration plays, I need to send some kind of STFU signal that temporarily either quiets or mutes the WMP output. So my core question is: What's the best way to accomplish this?

I know WMP has an ActiveX interface, but I'm not experienced with ActiveX/COM. I can (and probably will) learn, certainly, but at this point, I'm not well positioned to distinguish between solutions that are easy, solutions that are technically feasible but painful, and "solutions" that are actually blind alleys.

Would a Java-based solution require me to make use of a Java->ActiveX bridge like Jacob? Or is that overkill?

Or, am I barking up the wrong tree entirely? I'm certainly willing to deploy small command-line executables written in another language entirely and then access them via Runtime.exec(). Is this the sort of thing that (say) VisualBasic makes dirt simple? (VB isn't in my skillset either, but if it's the right tool for this job, I'll learn. I just don't know if it's the right tool. Google gave me plenty of examples of incorporating WMP into a VB GUI; VB command line script, not so much.)

Finally, one last point: the WMP instance would be started by the user, not started by the Java app. Don't know if that makes a difference, but figured it was worth mentioning.

My thanks in advance for any insight anybody can offer me.

Copier answered 2/4, 2009 at 20:45 Comment(0)
R
1

Your best bet is to use Jacob (or some other Java/COM bridge); I assume you don't want to just mute the system volume.

Ringtail answered 2/4, 2009 at 20:50 Comment(1)
Affirmative. Muting the system volume would also mute the narration, which would defeat the purpose. :-)Copier

© 2022 - 2024 — McMap. All rights reserved.