QuickTime Kit Programming Guide - filibeto.org
QuickTime Kit Programming Guide - filibeto.org
QuickTime Kit Programming Guide - filibeto.org
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
C H A P T E R 5<br />
Extending the QT<strong>Kit</strong>Player To Stream Audio and Video<br />
You’re done with the QT<strong>Kit</strong>PlayerAppDelegate.h declaration file.<br />
Adding Code To Your QT<strong>Kit</strong>PlayerDelegate.m<br />
In this next sequence of steps, you’ll be adding a larger chunk of code to your<br />
QT<strong>Kit</strong>PlayerAppDelegate.m implementation file.<br />
To begin, in the QT<strong>Kit</strong>PlayerAppDelegate.m file, you want to follow these steps:<br />
1. Insert the following import code at the beginning of your file:<br />
#import "QT<strong>Kit</strong>/QT<strong>Kit</strong>.h"<br />
#import "QT<strong>Kit</strong>PlayerAppDelegate.h"<br />
#import "MovieDocument.h."<br />
2. Following your import statement, you want add these enumerations. Insert these lines:<br />
{<br />
};<br />
kQT<strong>Kit</strong>PlayerOpenAsURL = 0,<br />
kQT<strong>Kit</strong>PlayerOpenAsData<br />
3. You also want to add QT<strong>Kit</strong>PlayAppDelegate after the @implementation directive. Insert this<br />
line:<br />
@implementation QT<strong>Kit</strong>PlayerAppDelegate<br />
4. Now you want to add the following lines for NSMenu validation protocols. Insert this block of<br />
code:<br />
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem<br />
{<br />
BOOLvalid = NO;<br />
SEL action;<br />
// init<br />
action = [menuItem action];<br />
// validate<br />
if (action == @selector(doOpenURL:))<br />
valid = YES;<br />
else if (action == @selector(doOpenURLData:))<br />
valid = YES;<br />
else<br />
valid = [[NSDocumentController sharedDocumentController]<br />
validateMenuItem:menuItem];<br />
}<br />
return valid;<br />
5. Next, you need to add these OpenURLPanel delegates. Insert these lines:<br />
- (void)openURLPanelDidEnd:(OpenURLPanel *)openURLPanel returnCode:(int)returnCode<br />
contextInfo:(void *)contextInfo<br />
{<br />
Adding Code To Stream Audio and Video 95<br />
2005-11-09 | © 2004, 2005 Apple Computer, Inc. All Rights Reserved.