Search code examples
iphoneiosxcodevideompmovieplayercontroller

MPMoviePlayerController slow forward and backward motion


Possible Duplicate:
Play/Forward video in 2x 3x 4x speed - iPhone SDK

I am currently working on a video based application. I'm using MPMoviePlayerController to play the video which i had recorded in my app. My question is what I have to do to play the video in slow forward and backward motion in MPMoviePlayerController?


Solution

  • -(IBAction) playSlow:(UIButton *)sender{
    
        if (frameRate > 1) 
            frameRate -= 0.5;
        else
            frameRate -= 0.25;
    
        if (frameRate < 0) {
            frameRate=0;
        }
    
        queuePlayer.rate = frameRate;
    }
    
    -(IBAction) playFast:(UIButton *)sender{
    
        if (frameRate < 1) 
            frameRate += 0.25;
        else
            frameRate += 0.50;
    
        if(frameRate > 4)
            frameRate = 4;
        queuePlayer.rate = frameRate;
    }