I am developing a mac application that involves audio playback.
I would like to pause other audio players when our playback starts.
how can I
1) detect that itunes is running
2) detect that itunes is currently playing
3) pause itunes
4) resume itunes when I am done
also:
5) Is the a way to pause other types of media playback as well? audio and video in the in the browser for example?
You can do that with the following code which is using ScriptingBridge:
The file
iTunes.his generated by runningsdef /Applications/iTunes.app | sdp -fh --basename iTunesfrom a commandline. The errorunknown type name "tdta"can be ignored.You also need to add ScriptingBridge.framework to the linked frameworks.
Here is also a link to the ScriptingBridge documentation.