02.04.2013 Views

QuickTime Kit Programming Guide - filibeto.org

QuickTime Kit Programming Guide - filibeto.org

QuickTime Kit Programming Guide - filibeto.org

SHOW MORE
SHOW LESS

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 />

Figure 5-12 Class model for delegate<br />

To begin, in your QT<strong>Kit</strong>Player project, choose File > New File. In the Assistant window for your new<br />

file in Xcode 2.0, select Cocoa > Objective-C class and in the window that opens enter the title<br />

QT<strong>Kit</strong>PlayerAppDelegate.h and check the box that also lets you create a QT<strong>Kit</strong>PlayerAppDelegate.m<br />

file. Now follow these steps:<br />

1. Insert the following import code at the beginning of your file:<br />

#import <br />

#import "OpenURLPanel.h"<br />

2. Add the following declaration code after your import statements:<br />

@interface QT<strong>Kit</strong>PlayerAppDelegate : NSObject<br />

3. Define a NSMenu validation protocol with the following line of code:<br />

- (BOOL)validateMenuItem:(NSMenuItem *)menuItem;<br />

4. Define the OpenURLPanel delegates with the following lines of code:<br />

- (void)openURLPanelDidEnd:(OpenURLPanel *)openURLPanel returnCode:(int)returnCode<br />

contextInfo:(void *)contextInfo;<br />

5. Define the actions with the following lines of code:<br />

- (IBAction)doOpenURL:(id)sender;<br />

- (IBAction)doOpenURLData:(id)sender;<br />

6. Define the method with the following line of code:<br />

- (BOOL)createMovieDocumentWithURL:(NSURL *)url asData:(BOOL)asData;<br />

94 Adding Code To Stream Audio and Video<br />

2005-11-09 | © 2004, 2005 Apple Computer, Inc. All Rights Reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!