通过Java跨平台控制itunes

发布于 2024-12-17 04:38:46 字数 261 浏览 4 评论 0原文

我的任务是通过 Java 程序控制 iTunes,并且必须在 OS X 或 Windows 上运行。

根据我的研究,大多数人的 Windows 控件似乎通过 COM 桥使用 Itunes/COM SDK,而 Mac 控件则使用 Applescript。

问题是我似乎找不到一种方法来将其开发为真正的跨平台,因为 OSX 所需的库似乎是内置的并且无法从 Windows 访问。

所以我想知道是否有人有解决方案或另一种跨平台方法来从任一操作系统控制 iTunes?

My brief requires me to control itunes through a Java Program and must work on either OS X or Windows.

From my research it seems most people's Windows Control uses the Itunes/COM SDK over a COM bridge, and Mac control uses Applescript.

Thing is I can't seem to find a way to develop this to be truely cross platform, because the libraries I need for OSX seems to be inbuilt and non-accessible from windows.

So I was wondering if anyone had a solution, or another cross platform way to control iTunes from either operating system?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

揪着可爱 2024-12-24 04:38:46

如果您只需要一些命令,例如播放、暂停、停止、下一个等,您可以尝试模拟全局按键事件并发送正确的 KeyCode(用于多媒体键)。在 Java 中,您可以使用 JNI 调用一个简单的 C 程序,该程序将为您模拟按键...或者您查看 Java 中的 Robot 类。

在 Windows 中,该函数被调用:keybd_event(keycode,0,0,0);

唯一的问题是其他程序(如果启动)可能也会对多媒体按键做出反应。

If you just need some commands like Play, pause, stop, next etc. you could try just to simulate a global keyPress event and sent the right KeyCode (for the multimedia Keys). In Java you can use JNI to call a simple C program which will simulates a Keypress for you...or you look at the Robot class in Java.

In windows the function is called: keybd_event(keycode,0,0,0);

The only problem is that other programs (if started) would probably also react to the multimedia keypresses.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文