• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
QTMovie brief pause
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

QTMovie brief pause


  • Subject: QTMovie brief pause
  • From: Albert Martin <email@hidden>
  • Date: Mon, 16 Feb 2009 18:22:39 -0500

I've been having a very frustrating issue with QTMovie/QTMovieLayer that I can't seem to get around. Right now I have a QTMovieLayer playing a QTMovie in a window. My goal is to be able to replace the QTMovieLayer with a new layer and movie by calling the replaceSublayer:with: method. This also works fine with everything be released and replaced as it should, and the current QTMovieLayer keeps playing until it is replaced.

The problem is very, very minor but nonetheless it is unacceptable with the purpose of the app. When calling all the code that replaces the old QTMovieLayer with the new one, the old video pauses for a brief second before the animation continues. After much debugging I've found out that the culprit call is when I tell the new QTMovie to "play" either by calling QTMovie.play or QTMovie.autoplay. If I do the exact same animation with the exact same code without the call to "play" the new layer, there is no brief pause and the animation performs flawlessly.

So my question is, is there a way to call QTMovie.play that is a bit gentler and won't cause the other QTMovie to pause briefly during the animation? If I called it in a separate thread would this likely solve the problem? I'm on a Quad-core Mac Pro so I know this isn't because I don't have the processing power. The CPU usage never gets above 30-40% and I'm playing an HD video.

Here's the code I'm using to swap out the QTMovieLayers:

if ([presentationMovieLayer superlayer] == [[presentationWindow contentView] layer]) {
newPresentationMovieLayer = [[QTMovieLayer alloc] init];
newPresentationMovieLayer.anchorPoint = CGPointMake(0, 0);
newPresentationMovieLayer.frame = CGRectMake(0,0,600,400);
newPresentationMovieLayer.movie = [QTMovie movieWithFile:path error:nil];
newPresentationMovieLayer.movie.autoplay; // THIS LINE IS THE PROBLEM ... IF I REMOVE THIS LINE EVERYTHING IS SMOOTH AND MY QTMOVIE DOESN'T PAUSE BRIEFLY
newPresentationMovieLayer.filters = presentationMovieLayer.filters;

[newPresentationMovieLayer.movie setAttribute:[NSNumber numberWithBool: YES] forKey:@"QTMovieLoopsAttribute"];

[CATransaction begin];
[CATransaction setValue:[NSNumber numberWithFloat:3.0] forKey:kCATransactionAnimationDuration];
[[[presentationWindow contentView] layer] replaceSublayer:presentationMovieLayer with:newPresentationMovieLayer];
[CATransaction commit];

// THIS JUST RELEASES THE OLD QTMOVIE AFTER THE TRANSITION IS FINISHED SO THAT THE OLD MOVIE KEEPS PLAYING THROUGH THE TRANSITION
[self performSelector: @selector(cleanUpOldMovieLayer)
withObject: nil
afterDelay: 3.0];
}
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please 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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: QTMovie brief pause
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Bindings: Why Doesn't Key Value validation Update The UI?
  • Next by Date: Re: Using NSRulerView with a non-text view
  • Previous by thread: Bindings: Why Doesn't Key Value validation Update The UI?
  • Next by thread: Re: QTMovie brief pause
  • Index(es):
    • Date
    • Thread