app crashes after checking network reachability in iphone?

岁酱吖の 提交于 2019-12-05 13:56:56
Saad

I think this is due to static player. Try using a property of movieplayer

Use:

@property (nonatomic,retain) MPMoviePlayerController *player;

In implementation:

@synthesize player = _player;

In init:

MPMoviePlayerController *plyr = [MPMoviePlayerController alloc] init];
self.player = plyr;
[plyr relaease];

In your code

[controller setContentURL:movieURL];
nicolimo86

I had the same problem. The solution that worked for me was remove the instruction

player.movieSourceType = MPMovieSourceTypeStreaming;
Manuel

I think this might be due to a player already existing.

try to add something like this:

if (player != nil) {
    [player release];
    player = nil; //i prefer to do both, just to be sure.
}

put it after the

[MainViewController  stopStreaming];  

and before the

player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://159.253.145.180:7104"]];

i'm not sure if this is right but if you have checked the link

MPMoviewPlayerController Class Reference

which includes the code from apple :

MPMoviePlayerController *player =
        [[MPMoviePlayerController alloc] initWithContentURL: myURL];
[player prepareToPlay];
[player.view setFrame: myView.bounds];  // player's frame must match parent's
[myView addSubview: player.view];
// ...
[player play];

maybe you need to prepareToPlay first and then add it to your view as subview..

i'm not sure but hope this helps..

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!