Checking if iTunes is shuffling is not working

徘徊边缘 提交于 2019-12-07 21:56:40

问题


I'm developing a Mac App and I need to check if Itunes (11.0) is shuffling my music so, to check that, I'm using iTunes.h and the following code:

if([iTunes.currentPlaylist shuffle]){
    NSLog(@"yes");
}else{
    NSLog(@"no");
}

Even though I have my iTunes shuffling, it always outputs "no".
Any ideas why is this happening or am I checking it the wrong way?


回答1:


Good luck with that.

I reported a bug about a month ago, like tons of other developers.
Didn't hear anything, and probably won't.

Like DigiMonk wrote, it a change in iTunes 11, but they don't update their API.




回答2:


This I know: in iTunes 11 some things changed. One of them is that the "shuffle"-option is playlist-independent...




回答3:


A long way around for the time being might be to listen for NSDistributedNotifications and check whether the attributes for the currently playing track match the previous or next one. It's not the cleanest solution, but it should work if what's being shuffled is an album or artist. Just check whether the track numbers go in sequence, or if the artist name is the same, etc.



来源:https://stackoverflow.com/questions/14221662/checking-if-itunes-is-shuffling-is-not-working

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