Thursday, February 17, 2011

Include iTunes

The next post series will cover the music program iTunes by Apple.
For that I will publish multiple posts, explaining different functions of the embedding.
In the first post I show, how to include iTunes to a C# program in general - therefor even no external software like the iTunes SDK is needed, already the "normal" iTunes installation will install the needed COM object.
To add such a reference to your C# project, click Project - Add Reference. There switch to the tab COM and select the object iTunes x.xx Type Library. And that is it, iTunes is ready.
For simplicity we import the corresponding library with using:
using iTunesLib;

In the program then an instance of the iTunes player can for example be instanced like this:

iTunesApp iTunesPlayer = new iTunesApp();

If this line is executed, iTunes opens and the player instance is connected to the C# object.
In the next post I describe how to traverse the music library / different playlists.

No comments:

Post a Comment