以编程方式控制Windows Media Player,最好是从Java [英] Programmatically Controlling Windows Media Player, Preferably From Java

查看:285
本文介绍了以编程方式控制Windows Media Player,最好是从Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为已经广泛部署的现有Java应用程序添加功能。 (所以除非我有一个认真的令人信服的理由,否则我无法触及一些设计决定。)该应用程序控制PC向一个小型本地电视网络广播音频和视频。目前,它主要播放静态幻灯片,但也可以由客户自行决定播放背景音乐。背景音乐(CD,本地音乐文件,网络电台等等)由Windows Media Player处理。



我当前的项目是在静态幻灯片中添加旁白。当叙述播放时,我需要发送某种STFU信号,暂时使WMP输出静音或静音。所以我的核心问题是:实现这个目标的最佳方法是什么?



我知道WMP有一个ActiveX接口,但我对ActiveX / COM没有经验。当然,我可以(也可能会)学习,但在这一点上,我不能很好地区分简单的解决方案,技术上可行但痛苦的解决方案,以及实际上是盲目小巷的解决方案。 p>

基于Java的解决方案是否需要我使用像Jacob这样的Java-> ActiveX桥?或者这有点矫枉过正?



或者,我是否完全吠叫了错误的树?我当然愿意完全部署用另一种语言编写的小命令行可执行文件,然后通过Runtime.exec()访问它们。这是(比方说)VisualBasic使污垢简单吗? (VB不在我的技能组合中,但如果它是这项工作的正确工具,我将学习。我只是不知道它是否是正确的工具.Google给了我很多将WMP合并到VB GUI中的例子; VB命令行脚本,不是那么多。)



最后,最后一点:WMP实例将由用户启动,而不是由Java应用程序启动。不知道这是否有所作为,但认为值得一提。



我提前感谢任何人可以提供给我的任何见解。

解决方案

最好的办法是使用Jacob(或其他一些Java / COM桥);我假设您不想只是将系统音量静音。


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.

解决方案

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.

这篇关于以编程方式控制Windows Media Player,最好是从Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆