MPMoviePlayerViewController Not playing video by streaming?

316 views Asked by At

I am using the below code to play the video, but its working fine while using the local url that mean resourse file path. Not working for server url.

player = [[MPMoviePlayerViewController alloc] initWithContentURL:urlvalue];
player.view.frame = CGRectMake(10, 10, 800, 800);
player.moviePlayer.shouldAutoplay=YES;

player.moviePlayer.movieSourceType= MPMovieSourceTypeFile;
[player.moviePlayer setControlStyle:MPMovieControlStyleDefault];

[self.view addSubview:player.view];
[player.moviePlayer prepareToPlay];
[player.moviePlayer play];

Kindly correct me if I missed out something. Thanks in advance.

2

There are 2 answers

1
Paresh Navadiya On

Change movieSourceType from File to Streaming :

player.moviePlayer.movieSourceType= MPMovieSourceTypeStreaming;

Note : url should be a streaming url not physical file path

1
milan.rancic On

Pay attention on iOS 9 App transport security. If you haven't set it up, streaming will fail with black empty screen.