Reputation: 1019
So I have to develop a full screen application in C#, and I was wondering if there's a way to control iTunes/Apple Music, that is running on the same PC (in the background). I would like something like play/pause, next, previous, MAAAYBE even selecting playlists.
Is this at all possible?
Upvotes: 0
Views: 422
Reputation: 20028
The answer to the question: "Can I automate ..." is - yes.
iTunes is a DACP-compatible music player (https://en.wikipedia.org/wiki/Digital_Audio_Control_Protocol).
There are multiple DACP implementations by the community, but the main shortcoming is that:
The DACP protocol are 100% RESTful HTTP calls that have to be reverse engineered by "sniffing" the communication between Itunes and the Apple Remote. It is a tedious task every time Apple changes something even in the slightest manner there is a lot of work to be done by the individual developers.
A decent example of how this is done: https://github.com/scott-t/iMote
However, in order to compile and run it, you need to fill the references and unless you want to compile for the framework 3.5 you need to replace some of the code. On the nice side, the Zeroconf that is used also supports .net core and async calls.
On the darker sides of grey, you have an option to decompile a application that you know already does this. Popular .net decompilers are ILSpy and ReSharper.
Upvotes: 2