Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cocos/ui/UIVideoPlayer-ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ @implementation UIVideoViewWrapperIos
-(id)init:(void*)videoPlayer
{
if (self = [super init]) {
self.playerController = [AVPlayerViewController new];
self.playerController = [[AVPlayerViewController new] autorelease];

[self setRepeatEnabled:FALSE];
[self showPlaybackControls:TRUE];
Expand Down
2 changes: 1 addition & 1 deletion cocos/ui/UIWebViewImpl-ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ - (void)dealloc {

- (void)setupWebView {
if (!self.wkWebView) {
self.wkWebView = [[WKWebView alloc] init];
self.wkWebView = [[[WKWebView alloc] init] autorelease];
self.wkWebView.UIDelegate = self;
self.wkWebView.navigationDelegate = self;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ bool VideoPlayerTest::init()

_visibleRect = Director::getInstance()->getOpenGLView()->getVisibleRect();

// Should create video first to make sure video is destryed first. If not, then may crash.
// Because when destroying video, it will stop video which may trigger stopped event listener.
createVideo();

MenuItemFont::setFontSize(16);

auto fullSwitch = MenuItemFont::create("FullScreenSwitch", CC_CALLBACK_1(VideoPlayerTest::menuFullScreenCallback, this));
Expand Down Expand Up @@ -95,8 +99,6 @@ bool VideoPlayerTest::init()
_loopStatusLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE_RIGHT);
_loopStatusLabel->setPosition(Vec2(_visibleRect.origin.x + _visibleRect.size.width - 10,_visibleRect.origin.y + 185));
_uiLayer->addChild(_loopStatusLabel);

createVideo();

return true;
}
Expand Down