From 85d5ad06830e9d571ad7be6c67a75919decbe35a Mon Sep 17 00:00:00 2001 From: knox Date: Thu, 28 Jun 2018 18:13:42 +0800 Subject: [PATCH] fix fullScreen and videoplay bug for wxgame --- cocos2d/core/platform/CCScreen.js | 4 ++-- cocos2d/core/videoplayer/CCSGVideoPlayer.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cocos2d/core/platform/CCScreen.js b/cocos2d/core/platform/CCScreen.js index 8af9cc3a92..0f769ae14a 100644 --- a/cocos2d/core/platform/CCScreen.js +++ b/cocos2d/core/platform/CCScreen.js @@ -83,7 +83,7 @@ cc.screen = /** @lends cc.screen# */{ var i, l, val, map = this._fnMap, valL; for (i = 0, l = map.length; i < l; i++) { val = map[i]; - if (val && val[1] in document) { + if (val && (typeof document[val[1]] !== 'undefined')) { for (i = 0, valL = val.length; i < valL; i++) { this._fn[map[0][i]] = val[i]; } @@ -101,7 +101,7 @@ cc.screen = /** @lends cc.screen# */{ * @returns {Boolean} */ fullScreen: function () { - if(!this._supportsFullScreen) return false; + if(!this._supportsFullScreen) return false; else if( document[this._fn.fullscreenElement] === undefined || document[this._fn.fullscreenElement] === null ) return false; else diff --git a/cocos2d/core/videoplayer/CCSGVideoPlayer.js b/cocos2d/core/videoplayer/CCSGVideoPlayer.js index 7c5156b1ad..a302909719 100644 --- a/cocos2d/core/videoplayer/CCSGVideoPlayer.js +++ b/cocos2d/core/videoplayer/CCSGVideoPlayer.js @@ -78,11 +78,11 @@ _ccsg.VideoPlayer = _ccsg.Node.extend(/** @lends _ccsg.VideoPlayer# */{ }, duration: function () { - return this._renderCmd.duration(); + return this._renderCmd.duration() || -1; }, currentTime: function() { - return this._renderCmd.currentTime(); + return this._renderCmd.currentTime() || -1; }, createDomElementIfNeeded: function () { @@ -314,7 +314,7 @@ _ccsg.VideoPlayer.EventType = { var node = this._node; - if (this._url == path) { + if (this._url === path) { return; } @@ -331,7 +331,7 @@ _ccsg.VideoPlayer.EventType = { video = this._video; var cb = function(){ - if(this._loaded == true) + if(this._loaded) return; this._loaded = true; node.setContentSize(node._contentSize.width, node._contentSize.height);