在cocos2dx版本中使用视频播放器的话 需要以下步骤
1、在写一个.mm的文件 我这里的mm叫IOSPlayVedio这个
头文件定义这个
static void playOnLineVideo4IOS(char *pszVideoUrl);
.mm里面写
void IOSPlayVedio::playOnLineVideo4IOS(char *pszVideoUrl)
{
NSString * strVideo = [NSString stringWithUTF8String:pszVideoUrl];
AppController *app = (AppController*) [[UIApplication sharedApplication] delegate];
[app playMovie:strVideo];
}
2、AppController 写一个方法
-(void)playVedio:(NSString *)videofile;
-(void)playMovie:(NSString *)str{
NSURL *url = [NSURL URLWithString:str];
MoviePlayerViewController *movieVC = [[MoviePlayerViewController alloc]initNetworkMoviePlayerViewControllerWithURL:url movieTitle:@"达达网络"];
movieVC.datasource = self;
[viewController presentViewController:movieVC animated:NO completion:nil];
}
在cocos2dx中调用的
pCoursewareInformation->themeResources_video_url//里面是视频的地址
代码下载地址
http://www.sundaboke.com/video.rar
原文链接:https://www.f2er.com/cocos2dx/344496.html