我经常使用iTunes API搜索歌曲,我希望用户能够选择一个选项来在iTunes中播放歌曲预览。
当前,以下内容将仅打开iTunes:
public class PlayMedia {
public PlayMedia()
{
Runtime runtime = Runtime.getRuntime();
String[] args = { "osascript", "-e", "tell application \"iTunes\" to play"};
try
{
Process process = runtime.exec(args);
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
public static void main(String[] args) throws IOException, JSONException {
new PlayMedia();
}
我该如何扩展以传递歌曲ID /标题?
答案 0 :(得分:0)
String[] args = {"osascript", "-e", "on run {arg1, arg2,…}",
"-e", " tell application \"iTunes\" to …",
"-e", "end run",
"--",
arg1, arg2, …};