Brandon
Brandon

Reputation: 3136

Setting of MPMoviePlayerViewController's initialPlaybackTime not working

I'm using an MPMoviePlayerViewController in my application and I'm trying to set the initial playback time by traversing the view controller's moviePlayer property and then setting the initial playback like so:

MPMoviePlayerViewController* moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:videoUrl];
moviePlayerViewController.moviePlayer.initialPlaybackTime = 100;
[self presentMoviePlayerViewControllerAnimated:moviePlayerViewController];

Regardless of what I pass in, the movie always starts from the beginning. What am I missing here?

Upvotes: 3

Views: 2193

Answers (1)

John Riselvato
John Riselvato

Reputation: 12904

Here is an example of my code with initialPlaybackTime working out of the box (simply copy and past code on viewController and play it).

    MPMoviePlayerViewController* theMovie =
    [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:@"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"]];
    theMovie.moviePlayer.controlStyle = MPMovieControlStyleEmbedded;
    [theMovie.view setFrame:CGRectMake(0.0, 20.0, 400.0, 250.0)];
    [theMovie.moviePlayer setInitialPlaybackTime:10];
    [self.view addSubview:theMovie.view];

If this works for you but your own video doesn't work, theres an issue with the video you are using, I guess.

Upvotes: 2

Related Questions