mirror of https://github.com/axmolengine/axmol.git
Add setPlayRate for UIVideoPlayer for windows only
This commit is contained in:
parent
15cf113e75
commit
4a35a8f8ae
|
@ -203,6 +203,8 @@ void VideoPlayer::setKeepAspectRatioEnabled(bool enable)
|
|||
}
|
||||
}
|
||||
|
||||
void VideoPlayer::setPlayRate(float fRate) {}
|
||||
|
||||
void VideoPlayer::play()
|
||||
{
|
||||
if (!_videoURL.empty())
|
||||
|
|
|
@ -339,6 +339,8 @@ void VideoPlayer::setStyle(StyleType style)
|
|||
}
|
||||
}
|
||||
|
||||
void VideoPlayer::setPlayRate(float fRate) {}
|
||||
|
||||
void VideoPlayer::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
|
||||
{
|
||||
cocos2d::ui::Widget::draw(renderer, transform, flags);
|
||||
|
@ -359,9 +361,9 @@ void VideoPlayer::draw(Renderer* renderer, const Mat4& transform, uint32_t flags
|
|||
auto uiTop = (frameSize.height / 2 - (rightTop.y - winSize.height / 2) * glView->getScaleY()) / scaleFactor;
|
||||
|
||||
[((UIVideoViewWrapperIos*)_videoContext) setFrame:
|
||||
uiLeft:uiTop:(rightTop.x - leftBottom.x) * glView->getScaleX() /
|
||||
scaleFactor:((rightTop.y - leftBottom.y) * glView->getScaleY() /
|
||||
scaleFactor)];
|
||||
uiLeft:uiTop:(rightTop.x - leftBottom.x) * glView->getScaleX() /
|
||||
scaleFactor:((rightTop.y - leftBottom.y) * glView->getScaleY() /
|
||||
scaleFactor)];
|
||||
}
|
||||
|
||||
# if CC_VIDEOPLAYER_DEBUG_DRAW
|
||||
|
|
|
@ -521,6 +521,16 @@ void VideoPlayer::setKeepAspectRatioEnabled(bool enable)
|
|||
}
|
||||
}
|
||||
|
||||
void VideoPlayer::setPlayRate(float fRate)
|
||||
{
|
||||
if (!_videoURL.empty())
|
||||
{
|
||||
auto vplayer = reinterpret_cast<PrivateVideoDescriptor*>(_videoContext)->_vplayer;
|
||||
if (vplayer)
|
||||
vplayer->SetRate(fRate);
|
||||
}
|
||||
}
|
||||
|
||||
void VideoPlayer::play()
|
||||
{
|
||||
if (!_videoURL.empty())
|
||||
|
|
|
@ -135,6 +135,13 @@ public:
|
|||
*/
|
||||
virtual void setStyle(StyleType style);
|
||||
|
||||
/**
|
||||
* Sets play rate, currently, only supported by windows
|
||||
*
|
||||
* @param fRate the rate for play, default 1.0
|
||||
*/
|
||||
virtual void setPlayRate(float fRate);
|
||||
|
||||
/**
|
||||
* Starts playback.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue