使用MPMoviePlayerController
在我的捆绑中播放视频文件,并使用重复模式MPMovieRepeatModeOne
。在视频播放时间内,在运行时需要50mb的大内存。请帮我解决这个问题。哪个是一个非常大的问题。一旦视频播放器被删除,消耗的内存就会消失
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"ConnectorAnimation.mp4" ofType:nil];
NSURL *fileURL = [NSURL fileURLWithPath:filepath];
mediaPlayer = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
mediaPlayer.fullscreen = YES;
mediaPlayer.repeatMode = MPMovieRepeatModeOne;
mediaPlayer.controlStyle = MPMovieControlStyleNone;
[_contentView addSubview:mediaPlayer.view];
CGRect frame = _contentView.bounds;
mediaPlayer.view.frame = frame;
mediaPlayer.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
[mediaPlayer play];