Getting blank white screen when presenting MPMoviePlayerViewController with no network connection
I am playing a media file present on the server. I purposely turned off the wifi connection in order to test the app. What I get is a blank screen.
What I want is to check before playing the video file is for internet connection. IF there is not connection, I dont want to play the video and display a alert message. How can I do so?
Can anyone help me on the same?
if ([[[UIDevice currentDevice] systemVersion ] doubleValue] >= 3.2) {
MPMoviePlayerViewController *mediaPlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:urlAddress]];
if (mediaPlayer) {
[self presentMoviePlayerViewControllerAnimated:mediaPlayer];
mediaPlayer.moviePlayer.movieSourceType = MPMo开发者_如何学GovieSourceTypeFile ;
[mediaPlayer.moviePlayer play];
[mediaPlayer release];
}
}
See the Reachability sample application.
精彩评论