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 4<br />
Adding New Capabilities to the QT<strong>Kit</strong>Player Application<br />
ComponentResult cr = noErr;<br />
MovieController mc = [mMovie quickTimeMovieController];<br />
if (!mc) goto bail;<br />
MCActionFilterWithRefConUPP upp =<br />
NewMCActionFilterWithRefConUPP(MyActionFilter);<br />
if (!upp) goto bail;<br />
cr = MCSetActionFilterWithRefCon(mc, upp, (long)self);<br />
DisposeMCActionFilterWithRefConUPP(upp);<br />
bail:<br />
return;<br />
}<br />
6. When the movie is closed, you remove the existing callback by passing NIL for the callback<br />
parameter. Add these lines of code:<br />
-(void)removeMovieIdleCallback<br />
{<br />
[MCSetActionFilterWithRefCon([mMovie quickTimeMovieController],<br />
nil,<br />
(long)self);<br />
}<br />
7. Insert the following code to toggle the drawer state:<br />
- (IBAction)toggleDrawer:(id)sender<br />
{<br />
[mDrawer toggle:sender];<br />
8. In the next sequence of steps (8-12), you add these chunks of code to the fields in the drawer. To<br />
set the current time text field, insert this chunk of code:<br />
- (void)setTimeDisplay<br />
{<br />
if (mMovie)<br />
{<br />
QTTime currentPlayTime = [[mMovie<br />
attributeForKey:QTMovieCurrentTimeAttribute] QTTimeValue];<br />
[mTimeDisplay setStringValue:QTStringFromTime(currentPlayTime)];<br />
}<br />
}<br />
9. To set the duration text field, insert this chunk of code:<br />
- (void)setDurationDisplay<br />
{<br />
if (mMovie)<br />
{<br />
[mDuration setStringValue:QTStringFromTime([mMovie duration])];<br />
}<br />
}<br />
10. To set the normal size text field, add this:<br />
- (void)setNormalSizeDisplay<br />
Adding Code To Your QT<strong>Kit</strong>Player Project 75<br />
2005-11-09 | © 2004, 2005 Apple Computer, Inc. All Rights Reserved.