Feeds

Serve up iTunes with Apple's media browser

Give your software some soul

Build a business case: developing custom apps

This returns an array of ILMediaGroup objects corresponding to the available playlists. An ILMediaGroup object encapsulates all sorts of different groups such as albums, recently played, recently added, and so on. If you want to filter this stuff, the simplest thing to do is use the type method to figure out what kind of group you're looking at. Turn on the DEBUG flag in my code - below - and you'll see all the different type numbers after each group name.

While on the subject of groups, it's also worth pointing out that one group can potentially contain subgroups. This functionality isn't directly supported by the iTunes user interface, but it is programmatically accessible.

OK, so we've got a list of playlists. Via the mediaObjects method, ILMediaGroup provides access to another array containing all the media objects in the group. Each object is of type ILMediaObject. Here's where things get really interesting: different methods give you access to information such as the name (song title), artist, play duration, and the fully qualified path of the media file itself.

iTunes library through the Mac browser

Methods access music information

Play it again...

For the sake of completeness, my demo application includes the ability to play a track: just double-click an item in the right-hand list and it will start playing. This is done by making use of the ILMediaBrowserAudioPlayer class that, once again, forms a part of the iLifeMediaBrowser library: it's what's used by the Apple browser when previewing a selected audio file. In essence, this class is a simple wrapper around QTMovie that forms part of the QuickTime framework.

If you want to make more sophisticated use of ILMediaBrowserAudioPlayer, you should be aware that it posts a number of undocumented notifications while it's working. These notifications - the meaning of each should be obvious from the name - are listed here:

  

MediaBrowserAudioPlayerWillBeginPlaying
MediaBrowserAudioPlayerDidBeginPlaying
MediaBrowserAudioPlayerDidBeginNextSong
MediaBrowserAudioPlayerDidFinishPlaying

You can listen out for these notifications in the usual way and take the appropriate action as required. In fact, even if you don't use any of the classes mentioned but simply use the standard media browser as described last time, these notifications will still be generated and can be exploited in the host application.

That's all we've got room for this time. You can download the demo application and source code that I mentioned earlier here. More undocumented naughtiness next time.®

HP ProLiant Gen8: Integrated lifecycle automation

More from The Register

next story
Secure microkernel that uses maths to be 'bug free' goes open source
Hacker-repelling, drone-protecting code will soon be yours to tweak as you see fit
NO MORE ALL CAPS and other pleasures of Visual Studio 14
Unpicking a packed preview that breaks down ASP.NET
KDE releases ice-cream coloured Plasma 5 just in time for summer
Melty but refreshing - popular rival to Mint's Cinnamon's still a work in progress
Leaked Windows Phone 8.1 Update specs tease details of Nokia's next mobes
New screen sizes, dual SIMs, voice over LTE, and more
Put down that Oracle database patch: It could cost $23,000 per CPU
On-by-default INMEMORY tech a boon for developers ... as long as they can afford it
Another day, another Firefox: Version 31 is upon us ALREADY
Web devs, Mozilla really wants you to like this one
Google shows off new Chrome OS look
Athena springs full-grown from Chromium project's head
prev story

Whitepapers

Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
Application security programs and practises
Follow a few strategies and your organization can gain the full benefits of open source and the cloud without compromising the security of your applications.
How modern custom applications can spur business growth
Learn how to create, deploy and manage custom applications without consuming or expanding the need for scarce, expensive IT resources.
Securing Web Applications Made Simple and Scalable
Learn how automated security testing can provide a simple and scalable way to protect your web applications.