Mughees Musaddiq
Mughees Musaddiq

Reputation: 1060

MPMovieplayercontroller automatically pauses while streaming and doesn't play again

I'm using MPMoviePlayerController to play my video from URL. Below is my code:

NSString* url = [[promotionalDetailResponse objectAtIndex:index] valueForKey:@"Url"];

        NSURL *streamURL = [NSURL URLWithString:url];
        mPlayerVC = [[MPMoviePlayerViewController alloc] initWithContentURL:streamURL];
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(moviePlaybackComplete:)
                                                     name:MPMoviePlayerPlaybackStateDidChangeNotification
                                                   object:nil];

        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(moviePlaybackComplete:)
                                                     name:MPMoviePlayerPlaybackDidFinishNotification
                                                   object:nil];
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(moviePlaybackComplete:)
                                                     name:MPMoviePlayerWillExitFullscreenNotification
                                                   object:nil];


        mPlayerVC.moviePlayer.fullscreen=YES;
        mPlayerVC.moviePlayer.shouldAutoplay=YES;
        [self presentMoviePlayerViewControllerAnimated:mPlayerVC];

It pauses while streaming and doesn't play automatically. I have to play it manually. However, it should start playing automatically once streaming is done.

Upvotes: 1

Views: 82

Answers (1)

Psykie
Psykie

Reputation: 176

You should mention the source type as follow:

mPlayerVC.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;

Upvotes: 1

Related Questions