How would i play a specific song in iTunes through java? [closed]

╄→гoц情女王★ 提交于 2019-12-11 06:43:14

问题


How would i play a specific song in iTunes through java?

I assume I need to somehow connect to iTunes and use the play function with a certain parameter....Can anyone point me in the right direction to learning how to do this?


回答1:


According to that answer, there is no API. There is only an SDK (via COM) for Windows. In Mac OS, iTunes is controlled via AppleScript(example).




回答2:


Ik it's too late, but u can use apple script editor. for instance,

Runtime runtime = Runtime.getRuntime();
                String[] args = {"osascript" , "-e" , "tell application \"iTunes\" to play"};
                try{
                Process process = runtime.exec(args);
                }catch (Exception ex) {                 
                }

this will play a song in itunes



来源:https://stackoverflow.com/questions/15872600/how-would-i-play-a-specific-song-in-itunes-through-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!