Created
June 13, 2014 08:33
-
-
Save gin0606/5f254961555587b5122e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool VideoPlayerScene::init() { | |
if (!Scene::init()) {return false;} | |
auto visibleSize = Director::getInstance()->getVisibleSize(); | |
auto videoPlayer = cocos2d::experimental::ui::VideoPlayer::create(); | |
videoPlayer->setContentSize(visibleSize); | |
videoPlayer->setPosition(Vec2(visibleSize.width/2, visibleSize.height / 2)); | |
videoPlayer->setEnabled(false); | |
videoPlayer->setKeepAspectRatioEnabled(true); | |
this->addChild(videoPlayer); | |
auto menu = Menu::createWithItem(MenuItemLabel::create(Label::createWithSystemFont("Play", "Arial", 24), | |
[videoPlayer](Ref *sender) { | |
videoPlayer->setFileName("video.mp4"); | |
videoPlayer->play(); | |
} | |
)); | |
menu->setPosition(visibleSize / 2); | |
this->addChild(menu); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment