fix tizen related issues

This commit is contained in:
zilongshanren 2016-05-18 16:26:13 +08:00
parent 50acf4c94b
commit c4e6db4e9b
3 changed files with 22 additions and 7 deletions

View File

@ -298,7 +298,6 @@ void VideoPlayer::play()
{ {
player_set_display_mode(impl->_player, PLAYER_DISPLAY_MODE_FULL_SCREEN); player_set_display_mode(impl->_player, PLAYER_DISPLAY_MODE_FULL_SCREEN);
} }
player_set_display_visible(impl->_player, true);
player_set_completed_cb(impl->_player, _player_completed_cb, this); player_set_completed_cb(impl->_player, _player_completed_cb, this);
player_set_interrupted_cb(impl->_player, _player_interrupted_cb, this); player_set_interrupted_cb(impl->_player, _player_interrupted_cb, this);
@ -309,6 +308,7 @@ void VideoPlayer::play()
{ {
this->onPlayEvent((int)VideoPlayer::EventType::PLAYING); this->onPlayEvent((int)VideoPlayer::EventType::PLAYING);
} }
this->setVisible(true);
} }
} }
@ -368,23 +368,32 @@ bool VideoPlayer::isPlaying() const
void VideoPlayer::onEnter() void VideoPlayer::onEnter()
{ {
Widget::onEnter(); Widget::onEnter();
this->setVisible(false); if (isVisible())
{
_VideoPlayerTizen* impl = (_VideoPlayerTizen*)_videoView;
player_set_display_visible(impl->_player, true);
}
} }
void VideoPlayer::onExit() void VideoPlayer::onExit()
{ {
Widget::onExit(); Widget::onExit();
this->setVisible(true); _VideoPlayerTizen* impl = (_VideoPlayerTizen*)_videoView;
player_set_display_visible(impl->_player, false);
} }
void VideoPlayer::setVisible(bool visible) void VideoPlayer::setVisible(bool visible)
{ {
cocos2d::ui::Widget::setVisible(visible); cocos2d::ui::Widget::setVisible(visible);
if (! _videoURL.empty())
{
_VideoPlayerTizen* impl = (_VideoPlayerTizen*)_videoView; _VideoPlayerTizen* impl = (_VideoPlayerTizen*)_videoView;
player_set_display_visible(impl->_player, visible);
if (!visible)
{
player_set_display_visible(impl->_player, false);
}
else if(isRunning())
{
player_set_display_visible(impl->_player, true);
} }
} }

View File

@ -1262,6 +1262,11 @@ void NodeNameTest::onEnter()
this->scheduleOnce(CC_CALLBACK_1(NodeNameTest::test, this), 0.05f, "test_key"); this->scheduleOnce(CC_CALLBACK_1(NodeNameTest::test, this), 0.05f, "test_key");
} }
void NodeNameTest::onExit()
{
TestCocosNodeDemo::onExit();
}
void NodeNameTest::test(float dt) void NodeNameTest::test(float dt)
{ {
auto parent = Node::create(); auto parent = Node::create();

View File

@ -325,6 +325,7 @@ public:
virtual std::string subtitle() const override; virtual std::string subtitle() const override;
virtual void onEnter() override; virtual void onEnter() override;
virtual void onExit() override;
void test(float dt); void test(float dt);
}; };