*****************.h**********
#include "ui/UIVideoPlayer.h"
#include "ui/CocosGUI.h"
void showVideo(const char* videoName);
void videoPlayOverCallback();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
void videoEventCallback(Ref* sender, cocos2d::experimental::ui::VideoPlayer::EventType eventType);
#endif
*****************.cpp**********
void CSuperTools::showVideo(const char* videoName){
if (!FileUtils::getInstance()->isFileExist(videoName)){
return;
}
Size size = Director::getInstance()->getVisibleSize();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
auto scene = Director::getInstance()->getRunningScene();
auto videoPlayer = cocos2d::experimental::ui::VideoPlayer::create();
videoPlayer->setPosition(Point(size.width / 2, size.height / 2));
videoPlayer->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
videoPlayer->setContentSize(Size(size.width, size.height));
videoPlayer->setTag(1000);
//videoPlayer->setTouchEnabled(false);
scene->addChild(videoPlayer);
if (videoPlayer)
{
videoPlayer->setFileName(videoName);
videoPlayer->play();
}
videoPlayer->addEventListener(CC_CALLBACK_2(CSuperTools::videoEventCallback, this));
#endif
}
void CSuperTools::videoPlayOv