MPMoviePlayerController and MPMediaPlayback.currentPlaybackRate

I'm trying to change the currentPlaybackRate of MPMoviePlayerController to slow down a video.

This is my source code:


moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];

[moviePlayer setCurrentPlaybackRate:0.5];

moviePlayer.currentPlaybackRate = 0.5;



I really don't understand. Where is my error (because there is no error in my console) ?

This is the Apple Documentations:


MPMoviePlayerController (class):
https://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/


MPMediaPlayback (protocol): https://developer.apple.com/library/prerelease/ios/documentation/MediaPlayer/Reference/MPMediaPlayback_protocol/index.html#//apple_ref/occ/intfp/MPMediaPlayback/currentPlaybackRate


Can you help me ?

We set moviePlayer.currentPlaybackRate all the time and it works well, but I believe you have to start the playback first and then set the speed. You might find that stopping and starting resets the rate to 1.0, so you'd have to set it to your desired value again each time playback starts. Check out what it is at different parts of your program with:


NSLog(@"Rate = %f", moviePlayer.currentPlaybackRate);


And you can set up a notification to tell you when it starts playing, with something like:


[[NSNotificationCenter defaultCenter] addObserver:self

selector:@selector(playbackStateChanged:)

name:MPMoviePlayerPlaybackStateDidChangeNotification

object:nil];

MPMoviePlayerController and MPMediaPlayback.currentPlaybackRate
 
 
Q