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 />
if (url)<br />
{<br />
// save the url<br />
if (![mUrlArray containsObject:urlString])<br />
{<br />
// save the url<br />
[mUrlArray addObject:urlString];<br />
// add the url to the combo box<br />
[mUrlComboBox addItemWithObjectValue:urlString];<br />
// remove the oldest url if the maximum has been exceeded<br />
if ([mUrlArray count] > kMaximumURLs)<br />
{<br />
[mUrlArray removeObjectAtIndex:0];<br />
[mUrlComboBox removeItemAtIndex:0];<br />
}<br />
}<br />
else<br />
{<br />
// move the url to the bottom of the list<br />
[mUrlArray removeObject:urlString];<br />
[mUrlArray addObject:urlString];<br />
[mUrlComboBox removeItemWithObjectValue:urlString];<br />
[mUrlComboBox addItemWithObjectValue:urlString];<br />
}<br />
}<br />
else<br />
{<br />
if (mIsSheet)<br />
NSRunAlertPanel(@"Invalid URL", @"The URL is not valid.", nil,<br />
nil, nil);<br />
else<br />
NSBeginAlertSheet(@"Invalid URL", nil, nil, nil, mPanel, nil,<br />
nil, nil, nil, @"The URL is not valid.");<br />
}<br />
}<br />
}<br />
informDelegate = NO;<br />
// inform the delegate<br />
if (informDelegate && mDelegate && mDidEndSelector)<br />
{<br />
callback = [mDelegate methodForSelector:mDidEndSelector];<br />
callback(mDelegate, mDidEndSelector, self, [sender tag], mContextInfo);<br />
}<br />
12. Add these lines of code to save the delegate and start the sheet:<br />
- (void)beginSheetWithWindow:(NSWindow *)window delegate:(id)delegate<br />
didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo<br />
{<br />
// will this run as a sheet<br />
mIsSheet = (window ? YES : NO);<br />
// save the delegate, did end selector, and context info<br />
mDelegate = delegate;<br />
92 Adding Code To Stream Audio and Video<br />
2005-11-09 | © 2004, 2005 Apple Computer, Inc. All Rights Reserved.