axmol/core/ui/UIVideoPlayer/UIVideoPlayer-ios.mm

527 lines
15 KiB
Plaintext
Raw Normal View History

/****************************************************************************
Copyright (c) 2014-2016 Chukong Technologies Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
Copyright (c) 2022 Bytedance Inc.
2022-01-04 12:36:20 +08:00
https://adxeproject.github.io/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "ui/UIVideoPlayer/UIVideoPlayer.h"
// No Available on tvOS
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS && !defined(CC_TARGET_OS_TVOS)
2014-05-09 11:30:07 +08:00
2019-10-23 14:58:31 +08:00
using namespace cocos2d::ui;
//-------------------------------------------------------------------------------------
2014-09-10 07:50:02 +08:00
2021-12-28 11:00:34 +08:00
# include "platform/ios/CCEAGLView-ios.h"
# import <AVKit/AVPlayerViewController.h>
# import <CoreMedia/CMTime.h>
# include "base/CCDirector.h"
# include "platform/CCFileUtils.h"
@interface UIVideoViewWrapperIos : NSObject
typedef NS_ENUM(NSInteger, PlayerbackState) {
PlayerbackStateUnknown = 0,
PlayerbackStatePaused,
PlayerbackStopped,
PlayerbackStatePlaying,
PlayerbackStateCompleted
};
2021-12-28 11:00:34 +08:00
@property(assign, nonatomic) AVPlayerViewController* playerController;
- (void)setFrame:(int)left:(int)top:(int)width:(int)height;
- (void)setURL:(int)videoSource:(std::string&)videoUrl;
- (void)play;
- (void)pause;
- (void)resume;
- (void)stop;
- (void)seekTo:(float)sec;
- (void)setVisible:(BOOL)visible;
- (void)setKeepRatioEnabled:(BOOL)enabled;
- (void)setFullScreenEnabled:(BOOL)enabled;
- (BOOL)isFullScreenEnabled;
- (void)showPlaybackControls:(BOOL)value;
- (void)setRepeatEnabled:(BOOL)enabled;
- (void)setUserInteractionEnabled:(BOOL)userInteractionEnabled;
- (id)init:(void*)videoPlayer;
- (void)videoFinished:(NSNotification*)notification;
@end
2021-12-28 11:00:34 +08:00
@implementation UIVideoViewWrapperIos {
int _left;
int _top;
int _width;
int _height;
BOOL _keepRatioEnabled;
BOOL _repeatEnabled;
BOOL _showPlaybackControls;
BOOL _userInteractionEnabled;
PlayerbackState _state;
2014-05-09 11:30:07 +08:00
VideoPlayer* _videoPlayer;
}
2021-12-28 11:00:34 +08:00
- (id)init:(void*)videoPlayer
{
2021-12-28 11:00:34 +08:00
if (self = [super init])
{
self.playerController = [AVPlayerViewController new];
[self setRepeatEnabled:FALSE];
[self showPlaybackControls:TRUE];
[self setUserInteractionEnabled:TRUE];
[self setKeepRatioEnabled:FALSE];
2021-12-28 11:00:34 +08:00
2014-05-09 11:30:07 +08:00
_videoPlayer = (VideoPlayer*)videoPlayer;
2021-12-28 11:00:34 +08:00
_state = PlayerbackStateUnknown;
}
2016-05-16 15:22:11 +08:00
return self;
}
2021-12-28 11:00:34 +08:00
- (void)dealloc
{
_videoPlayer = nullptr;
[self clean];
[self.playerController release];
[super dealloc];
}
2021-12-28 11:00:34 +08:00
- (void)clean
{
[self stop];
[self removePlayerEventListener];
[self.playerController.view removeFromSuperview];
}
2021-12-28 11:00:34 +08:00
- (void)setFrame:(int)left:(int)top:(int)width:(int)height
{
2021-12-28 11:00:34 +08:00
_left = left;
_width = width;
_top = top;
_height = height;
[self.playerController.view setFrame:CGRectMake(left, top, width, height)];
}
2021-12-28 11:00:34 +08:00
- (void)setFullScreenEnabled:(BOOL)enabled
{
// AVPlayerViewController doesn't provide API to enable fullscreen. But you can toggle
// fullsreen by the playback controllers.
}
2021-12-28 11:00:34 +08:00
- (BOOL)isFullScreenEnabled
{
return false;
}
2021-12-28 11:00:34 +08:00
- (void)showPlaybackControls:(BOOL)value
{
2021-12-28 11:00:34 +08:00
_showPlaybackControls = value;
self.playerController.showsPlaybackControls = value;
}
2021-12-28 11:00:34 +08:00
- (void)setRepeatEnabled:(BOOL)enabled
{
_repeatEnabled = enabled;
2021-12-28 11:00:34 +08:00
if (self.playerController.player)
{
if (_repeatEnabled)
self.playerController.player.actionAtItemEnd = AVPlayerActionAtItemEndNone;
else
self.playerController.player.actionAtItemEnd = AVPlayerActionAtItemEndPause;
}
}
2021-12-28 11:00:34 +08:00
- (void)setUserInteractionEnabled:(BOOL)userInteractionEnabled
{
2021-12-28 11:00:34 +08:00
_userInteractionEnabled = userInteractionEnabled;
self.playerController.view.userInteractionEnabled = _userInteractionEnabled;
}
2021-12-28 11:00:34 +08:00
- (void)setURL:(int)videoSource:(std::string&)videoUrl
{
[self clean];
2016-05-16 15:22:11 +08:00
if (videoSource == 1)
2021-12-28 11:00:34 +08:00
self.playerController.player =
[[[AVPlayer alloc] initWithURL:[NSURL URLWithString:@(videoUrl.c_str())]] autorelease];
else
2021-12-28 11:00:34 +08:00
self.playerController.player =
[[[AVPlayer alloc] initWithURL:[NSURL fileURLWithPath:@(videoUrl.c_str())]] autorelease];
2016-05-16 15:22:11 +08:00
[self setRepeatEnabled:_repeatEnabled];
[self setKeepRatioEnabled:_keepRatioEnabled];
[self setUserInteractionEnabled:_userInteractionEnabled];
[self showPlaybackControls:_showPlaybackControls];
2016-05-16 15:22:11 +08:00
2021-12-28 11:00:34 +08:00
auto view = cocos2d::Director::getInstance()->getOpenGLView();
auto eaglview = (CCEAGLView*)view->getEAGLView();
[eaglview addSubview:self.playerController.view];
[self registerPlayerEventListener];
}
2021-12-28 11:00:34 +08:00
- (void)videoFinished:(NSNotification*)notification
{
2021-12-28 11:00:34 +08:00
if (_videoPlayer != nullptr)
{
_videoPlayer->onPlayEvent((int)VideoPlayer::EventType::COMPLETED);
_state = PlayerbackStateCompleted;
2021-12-28 11:00:34 +08:00
if (_repeatEnabled)
{
[self seekTo:0];
[self play];
}
}
}
2021-12-28 11:00:34 +08:00
- (void)seekTo:(float)sec
{
if (self.playerController.player)
[self.playerController.player seekToTime:CMTimeMake(sec, 1)];
}
2021-12-28 11:00:34 +08:00
- (void)setVisible:(BOOL)visible
{
[self.playerController.view setHidden:!visible];
}
2021-12-28 11:00:34 +08:00
- (void)setKeepRatioEnabled:(BOOL)enabled
{
_keepRatioEnabled = enabled;
if (_keepRatioEnabled)
self.playerController.videoGravity = AVLayerVideoGravityResizeAspect;
else
self.playerController.videoGravity = AVLayerVideoGravityResizeAspectFill;
}
2021-12-28 11:00:34 +08:00
- (void)play
{
2021-12-28 11:00:34 +08:00
if (self.playerController.player && _state != PlayerbackStatePlaying)
{
[self.playerController.player play];
_state = PlayerbackStatePlaying;
_videoPlayer->onPlayEvent((int)VideoPlayer::EventType::PLAYING);
}
}
2021-12-28 11:00:34 +08:00
- (void)pause
{
2021-12-28 11:00:34 +08:00
if (self.playerController.player && _state == PlayerbackStatePlaying)
{
[self.playerController.player pause];
_state = PlayerbackStatePaused;
_videoPlayer->onPlayEvent((int)VideoPlayer::EventType::PAUSED);
}
}
2021-12-28 11:00:34 +08:00
- (void)resume
{
if (self.playerController.player && _state == PlayerbackStatePaused)
[self play];
}
2021-12-28 11:00:34 +08:00
- (void)stop
{
// AVPlayer doesn't have stop, so just pause it, and seek time to 0.
2021-12-28 11:00:34 +08:00
if (self.playerController.player && _state != PlayerbackStopped)
{
[self seekTo:0];
[self.playerController.player pause];
_state = PlayerbackStopped;
2021-12-28 11:00:34 +08:00
// stop() will be invoked in dealloc, which is invoked by _videoPlayer's destructor,
// so do't send the message when _videoPlayer is being deleted.
if (_videoPlayer)
_videoPlayer->onPlayEvent((int)VideoPlayer::EventType::STOPPED);
}
}
2021-12-28 11:00:34 +08:00
- (void)registerPlayerEventListener
{
if (self.playerController.player)
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(videoFinished:)
2021-12-28 11:00:34 +08:00
name:AVPlayerItemDidPlayToEndTimeNotification
object:self.playerController.player.currentItem];
}
2021-12-28 11:00:34 +08:00
- (void)removePlayerEventListener
{
if (self.playerController.player)
[[NSNotificationCenter defaultCenter] removeObserver:self
2021-12-28 11:00:34 +08:00
name:AVPlayerItemDidPlayToEndTimeNotification
object:self.playerController.player.currentItem];
}
@end
//------------------------------------------------------------------------------------------------------------
2014-05-09 11:30:07 +08:00
VideoPlayer::VideoPlayer()
{
_videoContext = [[UIVideoViewWrapperIos alloc] init:this];
2021-12-28 11:00:34 +08:00
# if CC_VIDEOPLAYER_DEBUG_DRAW
_debugDrawNode = DrawNode::create();
2014-09-15 17:59:51 +08:00
addChild(_debugDrawNode);
2021-12-28 11:00:34 +08:00
# endif
}
2014-05-09 11:30:07 +08:00
VideoPlayer::~VideoPlayer()
{
if (_videoContext)
{
[((UIVideoViewWrapperIos*)_videoContext) dealloc];
}
}
2021-12-26 23:26:34 +08:00
void VideoPlayer::setFileName(std::string_view fileName)
{
2021-12-28 11:00:34 +08:00
_videoURL = FileUtils::getInstance()->fullPathForFilename(fileName);
2014-05-14 11:18:11 +08:00
_videoSource = VideoPlayer::Source::FILENAME;
[((UIVideoViewWrapperIos*)_videoContext) setURL:(int) _videoSource:_videoURL];
}
2021-12-26 23:26:34 +08:00
void VideoPlayer::setURL(std::string_view videoUrl)
{
2021-12-28 11:00:34 +08:00
_videoURL = videoUrl;
2014-05-14 11:18:11 +08:00
_videoSource = VideoPlayer::Source::URL;
[((UIVideoViewWrapperIos*)_videoContext) setURL:(int) _videoSource:_videoURL];
}
void VideoPlayer::setLooping(bool looping)
{
_isLooping = looping;
[((UIVideoViewWrapperIos*)_videoContext) setRepeatEnabled:_isLooping];
}
void VideoPlayer::setUserInputEnabled(bool enableInput)
{
_isUserInputEnabled = enableInput;
[((UIVideoViewWrapperIos*)_videoContext) setUserInteractionEnabled:enableInput];
}
void VideoPlayer::setStyle(StyleType style)
{
_styleType = style;
2021-12-28 11:00:34 +08:00
switch (style)
{
case StyleType::DEFAULT:
[((UIVideoViewWrapperIos*)_videoContext) showPlaybackControls:TRUE];
2021-12-28 11:00:34 +08:00
break;
2021-12-28 11:00:34 +08:00
case StyleType::NONE:
[((UIVideoViewWrapperIos*)_videoContext) showPlaybackControls:FALSE];
2021-12-28 11:00:34 +08:00
break;
}
}
void VideoPlayer::setPlayRate(float fRate) {}
2021-12-28 11:00:34 +08:00
void VideoPlayer::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
{
2021-12-28 11:00:34 +08:00
cocos2d::ui::Widget::draw(renderer, transform, flags);
2016-05-16 15:22:11 +08:00
2014-06-03 07:02:54 +08:00
if (flags & FLAGS_TRANSFORM_DIRTY)
{
auto directorInstance = Director::getInstance();
2021-12-28 11:00:34 +08:00
auto glView = directorInstance->getOpenGLView();
auto frameSize = glView->getFrameSize();
auto scaleFactor = [static_cast<CCEAGLView*>(glView->getEAGLView()) contentScaleFactor];
2016-05-16 15:22:11 +08:00
auto winSize = directorInstance->getWinSize();
2016-05-16 15:22:11 +08:00
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
auto leftBottom = convertToWorldSpace(Vec2::ZERO);
2021-12-28 11:00:34 +08:00
auto rightTop = convertToWorldSpace(Vec2(_contentSize.width, _contentSize.height));
2016-05-16 15:22:11 +08:00
2021-12-28 11:00:34 +08:00
auto uiLeft = (frameSize.width / 2 + (leftBottom.x - winSize.width / 2) * glView->getScaleX()) / scaleFactor;
auto uiTop = (frameSize.height / 2 - (rightTop.y - winSize.height / 2) * glView->getScaleY()) / scaleFactor;
2016-05-16 15:22:11 +08:00
[((UIVideoViewWrapperIos*)_videoContext) setFrame:
uiLeft:uiTop:(rightTop.x - leftBottom.x) * glView->getScaleX() /
scaleFactor:((rightTop.y - leftBottom.y) * glView->getScaleY() /
scaleFactor)];
}
2016-05-16 15:22:11 +08:00
2021-12-28 11:00:34 +08:00
# if CC_VIDEOPLAYER_DEBUG_DRAW
_debugDrawNode->clear();
2021-12-28 11:00:34 +08:00
auto size = getContentSize();
Point vertices[4] = {Point::ZERO, Point(size.width, 0), Point(size.width, size.height), Point(0, size.height)};
2014-09-15 17:59:51 +08:00
_debugDrawNode->drawPoly(vertices, 4, true, Color4F(1.0, 1.0, 1.0, 1.0));
2021-12-28 11:00:34 +08:00
# endif
}
2021-12-28 11:00:34 +08:00
bool VideoPlayer::isFullScreenEnabled() const
{
return [((UIVideoViewWrapperIos*)_videoContext) isFullScreenEnabled];
}
2014-05-09 11:30:07 +08:00
void VideoPlayer::setFullScreenEnabled(bool enabled)
{
[((UIVideoViewWrapperIos*)_videoContext) setFullScreenEnabled:enabled];
}
2014-05-09 11:30:07 +08:00
void VideoPlayer::setKeepAspectRatioEnabled(bool enable)
{
if (_keepAspectRatioEnabled != enable)
{
_keepAspectRatioEnabled = enable;
[((UIVideoViewWrapperIos*)_videoContext) setKeepRatioEnabled:enable];
}
}
2014-05-14 11:18:11 +08:00
void VideoPlayer::play()
{
2021-12-28 11:00:34 +08:00
if (!_videoURL.empty())
{
[((UIVideoViewWrapperIos*)_videoContext) play];
}
}
2014-05-14 11:18:11 +08:00
void VideoPlayer::pause()
{
2021-12-28 11:00:34 +08:00
if (!_videoURL.empty())
{
[((UIVideoViewWrapperIos*)_videoContext) pause];
}
}
2014-05-14 11:18:11 +08:00
void VideoPlayer::resume()
{
2021-12-28 11:00:34 +08:00
if (!_videoURL.empty())
{
[((UIVideoViewWrapperIos*)_videoContext) resume];
}
}
2014-05-14 11:18:11 +08:00
void VideoPlayer::stop()
{
2021-12-28 11:00:34 +08:00
if (!_videoURL.empty())
{
[((UIVideoViewWrapperIos*)_videoContext) stop];
}
}
2014-05-14 11:18:11 +08:00
void VideoPlayer::seekTo(float sec)
{
2021-12-28 11:00:34 +08:00
if (!_videoURL.empty())
{
[((UIVideoViewWrapperIos*)_videoContext) seekTo:sec];
}
}
2014-05-09 11:30:07 +08:00
bool VideoPlayer::isPlaying() const
{
return _isPlaying;
}
bool VideoPlayer::isLooping() const
{
return _isLooping;
}
bool VideoPlayer::isUserInputEnabled() const
{
return _isUserInputEnabled;
}
2014-05-09 11:30:07 +08:00
void VideoPlayer::setVisible(bool visible)
{
cocos2d::ui::Widget::setVisible(visible);
2016-05-16 15:22:11 +08:00
if (!visible)
{
[((UIVideoViewWrapperIos*)_videoContext) setVisible:NO];
2016-05-16 15:22:11 +08:00
}
2021-12-28 11:00:34 +08:00
else if (isRunning())
2016-05-16 15:22:11 +08:00
{
[((UIVideoViewWrapperIos*)_videoContext) setVisible:YES];
}
}
2016-05-16 15:22:11 +08:00
void VideoPlayer::onEnter()
{
Widget::onEnter();
if (isVisible())
{
[((UIVideoViewWrapperIos*)_videoContext) setVisible:YES];
2016-05-16 15:22:11 +08:00
}
}
void VideoPlayer::onExit()
{
Widget::onExit();
[((UIVideoViewWrapperIos*)_videoContext) setVisible:NO];
2016-05-16 15:22:11 +08:00
}
2014-05-14 11:18:11 +08:00
void VideoPlayer::addEventListener(const VideoPlayer::ccVideoPlayerCallback& callback)
{
2014-05-14 11:18:11 +08:00
_eventCallback = callback;
}
void VideoPlayer::onPlayEvent(int event)
{
2021-12-28 11:00:34 +08:00
if (event == (int)VideoPlayer::EventType::PLAYING)
{
_isPlaying = true;
2021-12-28 11:00:34 +08:00
}
else
{
_isPlaying = false;
}
2016-05-16 15:22:11 +08:00
2014-05-14 11:18:11 +08:00
if (_eventCallback)
{
_eventCallback(this, (VideoPlayer::EventType)event);
}
}
2014-05-23 15:03:46 +08:00
cocos2d::ui::Widget* VideoPlayer::createCloneInstance()
{
return VideoPlayer::create();
}
2021-12-28 11:00:34 +08:00
void VideoPlayer::copySpecialProperties(Widget* widget)
2014-05-23 15:03:46 +08:00
{
VideoPlayer* videoPlayer = dynamic_cast<VideoPlayer*>(widget);
if (videoPlayer)
{
2021-12-28 11:00:34 +08:00
_isPlaying = videoPlayer->_isPlaying;
_isLooping = videoPlayer->_isLooping;
_isUserInputEnabled = videoPlayer->_isUserInputEnabled;
_styleType = videoPlayer->_styleType;
_fullScreenEnabled = videoPlayer->_fullScreenEnabled;
_fullScreenDirty = videoPlayer->_fullScreenDirty;
_videoURL = videoPlayer->_videoURL;
2014-05-23 15:03:46 +08:00
_keepAspectRatioEnabled = videoPlayer->_keepAspectRatioEnabled;
2021-12-28 11:00:34 +08:00
_videoSource = videoPlayer->_videoSource;
_videoPlayerIndex = videoPlayer->_videoPlayerIndex;
_eventCallback = videoPlayer->_eventCallback;
2014-05-23 15:03:46 +08:00
}
}
#endif