How to change the speed of video playback

前端 未结 3 1655
野趣味
野趣味 2020-12-10 22:09

I\'m wondering if it\'s possible to change the video playback speed in an iphone application. we want users to yell in the microphone to speed up the playback and get to the

相关标签:
3条回答
  • 2020-12-10 22:50

    There is a rate property for the AVPlayer.

    If you take the example from Apple called "avPlayerDemo" in the resource section, you then simply have to set the mplayer.rate. It worked for me, I created a new slider in the xib files, implemented that slider in the AVPlayerDemoPlaybackViewController and simply set mPlayer.rate to the slider value.

    0 讨论(0)
  • 2020-12-10 22:50

    What about the MPMoviePlayerController?

    setCurrentPlaybackRate 
    

    Here's some code which does not work at that spot

    -(IBAction)abspielen:(id)sender 
    {
        NSString *titleOfButton = [sender titleForState:UIControlStateNormal];
        NSBundle *bundle = [NSBundle mainBundle];
        NSString *moviePath = [bundle pathForResource:titleOfButton ofType:@"mov"];
        NSURL *movieURL = [ NSURL fileURLWithPath:moviePath];
    
        MPMoviePlayerController *themovie = [[MPMoviePlayerController alloc]initWithContentURL: movieURL];  
        [themovie play];
        [themovie setCurrentPlaybackRate:2.f];    
        [themovie release];
    
        MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];
        [self presentMoviePlayerViewControllerAnimated:moviePlayer];
        [moviePlayer release];              
    }
    
    0 讨论(0)
  • 2020-12-10 22:58

    You have to use setCurrentPlaybackRate:

    0 讨论(0)
提交回复
热议问题