所以我必须用C#开发一个全屏应用程序,我想知道是否存在一种控制iTunes / Apple Music的方法,该方法可以在同一台PC上(在后台)运行。 我想要播放/暂停,下一个,上一个,MAAAYBE之类的东西,甚至选择播放列表。
这有可能吗?
答案 0 :(得分:1)
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.