Cant using VideoPlayer - Cocos2d-x v4

Hello everyone, im tring to play video using cocos2d::ui::VideoPlayer in windows and android. but unfortunately, VideoPlayer is not found. i’ve look on cpp test and try to coppied them to my code. but stil, VideoPlayer is undefined.

i dont know how its happen, here my code.

file.h

#include "cocos2d.h"
#include "extensions/cocos-ext.h"
#include "ui/CocosGUI.h"
using namespace ui;
#include "extensions/cocos-ext.h"
#include "editor-support/cocostudio/CCSGUIReader.h"

class MyGame: public Layer
{
private:
cocos2d::ui::VideoPlayer* _video;
}

file.cpp

_video = VideoPlayer::create();
_video->setPosition(Vec2(512, 384));
_video->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
_video->setContentSize(Size(960, 640));
_video->setStyle(cocos2d::ui::VideoPlayer::StyleType::NONE);

this->addChild(_video);

_video->setFileName("video.mp4");
_video->play();

in my visual studio 2017, VideoPlayer is undefined. its like not found in cocos file. or, Anyway to play video in cocos2dx v4 ? Thanks.

This only available for Android & iOS.
Windows its not supported.

1 Like

Hi @smitpatel88, thanks for the answer.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.