Skip navigation.
 
mlRe: QTKit: handle movie playback progress
FROM : Michael Watson
DATE : Mon Apr 09 16:22:03 2007

There is nothing wrong with mixing the C QuickTime API and QTKit. How 
do you think iMovie works?

Where did you read mixing the two was a bad thing?


--
m-s

On 09 Apr, 2007, at 07:52, Sergey Shapovalov wrote:

> Forgot to mention one more variant (providing it here for 
> completeness).
>
> 4. Use SetMovieProgressProc from QuickTime SDK. But AFAIK mixing 
> QuickTime SDK (C API) with QTKit (Obj-C API) is not a good idea... 
> Or is it?
>
> Best regards,
> Sergey.
>
> On Apr 9, 2007, at 3:35 PM, Sergey Shapovalov wrote:
>

>> My application contains a preview window with a QTMovieView in 
>> which I play QuickTime movies. I want to update my controls (for 
>> example, move a slider) as the movie being played goes on (this is 
>> quite a typical issue, I assume). My question is: what is the 
>> recommended way to achieve this? At the moment, I see 3 following 
>> variants.
>>
>> 1. Timer. I can update my controls on a timer just like in this 
>> sample code:
>> http://www.macdevcenter.com/pub/a/mac/2003/08/15/quicktime_cocoa.html
>> While QTMovieView is playing a movie, the timer fires every 0.1 
>> sec and sends a message to my window controller making it update 
>> the controls.
>>
>> Everything does work for me except one thing. When I begin 
>> resizing the window, the movie goes on playing, but the timer 
>> stops firing, and thus the slider stops moving. Can I use threads 
>> to overcome this defect?
>>
>> Besides, using hard-coded constants (like 0.1 sec) is not what is 
>> typically considered as right design. Using callbacks is typically 
>> recommended for cases like this. So I went on looking for other 
>> solutions...
>>
>> 2. Delegate. I can associate a delegate class with the movie being 
>> played, and implement movieShouldTask method in the delegate. With 
>> this approach, I face exactly the same problem as the one I found 
>> in this list archives (posted more than a year ago):
>>
>> On Mar 5, 2006, at 2:32 PM, Aleaxander Cohen wrote:

>>> Im using a QTMovie in an app to control music and video. Whenever 
>>> i send the 'play' message, the media starts playing for about 3 
>>> seconds, then abruptly stops. <...> I did find a fix, but im not 
>>> sure why i actually need to do this with QTKit. Im calling 
>>> 'MoviesTask(NULL, 0)' in the QTMovie movieShouldTask: delegate.

>>
>> The same happens to me. Everything is all right when I don't 
>> associate my delegate class with the movie, or when my delegate 
>> doesn't implement movieShouldTask method, or when I call MoviesTask
>> (NULL, 0) from this method. However, I also found a reply from Tim 
>> Monroe to that letter (so I added Tim to recipients of this my e-
>> mail):
>>

>>> The movieShouldTask: delegate is not officially deprecated, but 
>>> its use is not currently advised.

>>
>> Does that mean that using QTMovie delegate to handle movie 
>> playback progress is not recommended?
>>
>> 3. Notifications. I can register a handler for QuickTime 
>> notifications and update controls when a matching notification 
>> arrives. The problem is that I'm not sure if QT does periodically 
>> send any notification while just playing a movie. 
>> QTMovieTimeDidChangeNotification seemed to be the right one, but 
>> as I found on the web, "The QTMovieTimeDidChangeNotification 
>> notification is not, for instance, posted whenever the movie time 
>> changes; rather, it's posted whenever the movie time changes to a 
>> value different from what it would be during normal movie 
>> playback." So, is there any other notification I can use?
>>
>> Best regards,
>> Sergey.

>
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> Do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/mikey-san%
> 40bungie.org
>
> This email sent to <email_removed>

Related mailsAuthorDate
mlQTKit: handle movie playback progress Sergey Shapovalov Apr 9, 13:35
mlRe: QTKit: handle movie playback progress Sergey Shapovalov Apr 9, 13:52
mlRe: QTKit: handle movie playback progress Michael Watson Apr 9, 16:22
mlRe: QTKit: handle movie playback progress Sergey Shapovalov Apr 9, 16:32
mlRe: QTKit: handle movie playback progress Michael Watson Apr 9, 16:49
mlRe: QTKit: handle movie playback progress Sergey Shapovalov Apr 10, 07:52
mlRe: QTKit: handle movie playback progress Shamyl Zakariya Apr 10, 19:22
mlRe: QTKit: handle movie playback progress Tim Monroe Apr 10, 22:25