Jayaraj
Jayaraj

Reputation: 261

MPMoviePlayerViewController Not playing video by streaming?

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.

Upvotes: 0

Views: 317

Answers (2)

milan.rancic
milan.rancic

Reputation: 219

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

Upvotes: 1

Paresh Navadiya
Paresh Navadiya

Reputation: 38239

Change movieSourceType from File to Streaming :

player.moviePlayer.movieSourceType= MPMovieSourceTypeStreaming;

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

Upvotes: 0

Related Questions