views:

301

answers:

1

I have a Cocoa app that has two views. Both of these views are a subclass of QTMovieView. I want to play the same movie in both views (one view is a smaller preview of the larger view). Right now I'm doing:

QTMovie *movie = [[QTMovie alloc] initWithFile:path error:nil];  
[largeView setMovie:movie];  
[smallView setMovie:movie];

When I do this the movie is jumpy, it doesn't play smoothly. If I just set the movie to one or the other it seems to play just fine. I've tried multiple movies and they all do the same thing. Any ideas? Is there a better way to do this?

A: 

You are probably overtaxing a resource - CPU and/or disk I/O are your most likely culprits.

If you open two Quicktime windows can you play the movies at the same time without stuttering? Is your CPU maxed out (especially on a single-core machine)? Can you stream from a second source and fix the stuttering? You might try playing one of the movies off a USB hard drive or flash drive if you don't have two hard drives.

I'm not a quicktime or Objective-C programmer, but I'd start by looking at mirroring the content instead of opening two movie instances. Maybe you can capture a section of the screen, shrink the contents and dump it to a smaller preview window.

Dana Robinson
I have a dual-core macbook pro with 4 GB of RAM that has no problem playing two videos at one time. When I run both in quicktime or in my program I'm only using about 1/2 of each CPU.
Austin
Are you streaming off the same hard drive? Even though they are the same movie you might be hitting I/O issues since you have created two separate movie objects. Disks work best when they can do big linear reads and jumping back a frame for the other movie will wreck that.
Dana Robinson
I am reading off the same hard drive, but it is just one movie object that I'm setting for both MovieViews. For example, if I set the movie for both MovieViews and just tell one view to play, they both show the movie playing, I guess because both MovieViews are connected to the same Movie.
Austin