Feeds

Behind the scenes with Apple's media browser

Integrated advantage

Providing a secure and efficient Helpdesk

With free media browsers available, why use the undocumented Apple one? Well, aside from the fact that it's also free, the Apple media browser has a few additional strings to its bow. One big advantage is that the Apple browser supports the Events feature recently added to iPhoto 7. As far as I know, no other media browser supports this, meaning that photo browsing is much less convenient.

Introducing ILMediaBrowserView

So how do you make use of the Apple browser? This turns out to be simplicity itself. Create a new, windowed, Cocoa application project in Xcode, and drag Apple's private iLifeMediaBrowser.framework into the frameworks section of your project window. You'll find it hiding inside /System/Library/PrivateFrameworks. Now edit your MainMenu.nib file by adding a custom view to it in the usual way. Use Interface Builder's Inspector window to change the custom view's class name to ILMediaBrowserView. Now save and run your application. Voila - you've got an instant media browser!

Didn't work for you? Chances are you're not running Leopard. Apple added the iLifeMediaBrowser framework to the 10.5 SDK, but it's not a part of the 10.4 SDK. Yes, it's perfectly possible to use the Apple Media Browser without problems under Tiger, but it involves a few more wrinkles than there's room to discuss here. Instead, let's look a little deeper at the ILMediaBrowserView object.

By default, the browser operates in audio mode - meaning you'll see a list of all your iTunes albums, podcasts and other media in the usual format. I've added a little code to the demo program to illustrate how to switch modes for photo browsing or movie browsing. As mentioned earlier, when you're browsing photos, you'll see a list of defined iTunes events. If you don't want to use the setCurrentBrowserType: method, there are three distinct methods which switch between the wanted modes as below:


- (void)displayAudioBrowser:(id)sender;
- (void)displayImageBrowser:(id)sender;
- (void)displayMovieBrowser:(id)sender;

All the other available methods are included in ILMediaBrowserView.h, which is included as part of the project. As ever, I used the class-dump utility to create this header file. You'll see that there are a number of options here for customising the appearance of the browser. For example, setTableAlternatingRowColors: can be used to set custom colors for table rows when displaying media:


[_browser setTableAlternatingRowColors: 
    [NSArray arrayWithObjects: 
         [NSColor colorWithCalibratedWhite: 0.2 alpha: 0.8], 
         [NSColor colorWithCalibratedWhite: 0.25 alpha: 0.8], 
       nil]];

Personally, I would be strongly disinclined to mess with that stuff because the last thing you want is to confuse the end user with a weird-looking media browser. If you're planning to embed the browser in a HUD window, though, then some judicious customization would make sense.

In case you're wondering how to actually select media in an application, the answer of course is drag and drop. I've added an editable NSImageView control to the demo program to illustrate the point. More typically, you'd build the image browser into a panel, and drag from there into the main document window. The demo program can be downloaded from here.

Have fun with the Apple media browser. More undocumented naughtiness next time.®

Reducing the cost and complexity of web vulnerability management

More from The Register

next story
'Windows 9' LEAK: Microsoft's playing catchup with Linux
Multiple desktops and live tiles in restored Start button star in new vids
Not appy with your Chromebook? Well now it can run Android apps
Google offers beta of tricky OS-inside-OS tech
New 'Cosmos' browser surfs the net by TXT alone
No data plan? No WiFi? No worries ... except sluggish download speed
Greater dev access to iOS 8 will put us AT RISK from HACKERS
Knocking holes in Apple's walled garden could backfire, says securo-chap
NHS grows a NoSQL backbone and rips out its Oracle Spine
Open source? In the government? Ha ha! What, wait ...?
Google extends app refund window to two hours
You now have 120 minutes to finish that game instead of 15
Intel: Hey, enterprises, drop everything and DO HADOOP
Big Data analytics projected to run on more servers than any other app
prev story

Whitepapers

Providing a secure and efficient Helpdesk
A single remote control platform for user support is be key to providing an efficient helpdesk. Retain full control over the way in which screen and keystroke data is transmitted.
Saudi Petroleum chooses Tegile storage solution
A storage solution that addresses company growth and performance for business-critical applications of caseware archive and search along with other key operational systems.
Security and trust: The backbone of doing business over the internet
Explores the current state of website security and the contributions Symantec is making to help organizations protect critical data and build trust with customers.
Reg Reader Research: SaaS based Email and Office Productivity Tools
Read this Reg reader report which provides advice and guidance for SMBs towards the use of SaaS based email and Office productivity tools.
Security for virtualized datacentres
Legacy security solutions are inefficient due to the architectural differences between physical and virtual environments.