AppController.h
@property(nonatomic,readonly) UIView * videoView;
AppController.mm
viewController.view.tag = 3; //给原来的view设置tag值
UIViewController* uiVC = [[UIViewController alloc] initWithNibName:nil bundle:nil];
uiVC.view.frame = [UIScreen mainScreen].bounds;
_videoView = [[UIView alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
_videoView.tag = 1; //设置tag以便之后把Video层取出来~
[uiVC.view addSubview:_videoView];
[uiVC.view addSubview:viewController.view];
UIVideoPlayer-ios.mm
-(void) setURL:(int)videoSource :(std::string &)videoUrl {
//在这个函数里
//[eaglview addSubview:self.moviePlayer.view]; 将原来的 改为下面的这个
if([eaglview.superview viewWithTag:1]!= nullptr){
[[eaglview.superview viewWithTag:1] addSubview:self.moviePlayer.view];
}else{
[eaglview addSubview:self.moviePlayer.view];
}
}