views:

13

answers:

1

Hi everyone! I'm working on a program prototype that (at the current stage) just needs to be able to load a movie and adjust the playback speed. I have the UI worked out, I've gotten the playback to work, but I haven't managed to figure out how to adjust the playback speed.

I believed that -[QTMovie setRate:(float)] was the way to do this, but I have had no luck. Even when setting the playback speed prior to loading the movie into the QTMovieView, the movie simply plays at 100% speed. I have put in textual outputs to check at what speed the movie "believes" it is being played, and that checks out with what I've been putting in, but the movie still displays in the view at 100% speed.

Here's some code from the controller:

@interface SRPlayerController : NSObject {
    QTMovieView *movieView;
}
@end

@implementation SRPlayerController
-(void) playSelectedMovie
{
    SRMovie *srm = [self selectedMovie];    
    QTMovie *mov = [self movieForSRMovie:srm];

    //set play speed
    [self setPlaySpeed:[srm.defaultPlaySpeed floatValue] forMovie:mov];

    //put movie into viewer
    [movieView setMovie:mov];

    //play
    [movieView play:self];
}

-(void) setPlaySpeed:(float)ps forMovie:(QTMovie*)movie
{
    NSLog(@"setting play speed to %f", ps);

    [movie setRate:ps]; 

    NSLog(@"movie playing at speed: %f", [movie rate]);
}
@end

I appreciate your response.

A: 

Wow I'm an idiot.

apparently you can't adjust the playback when it's not playing. all I had to do was change the order of -playselectedmovie calls so that it was playing before it adjusted the speed.

zwerdlds