开发者

Getting blank white screen when presenting MPMoviePlayerViewController with no network connection

开发者 https://www.devze.com 2023-02-14 15:55 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消