diff --git a/cocos2d/core/components/CCVideoPlayer.js b/cocos2d/core/components/CCVideoPlayer.js index e7044779d3..1de87bf61a 100644 --- a/cocos2d/core/components/CCVideoPlayer.js +++ b/cocos2d/core/components/CCVideoPlayer.js @@ -326,7 +326,7 @@ var VideoPlayer = cc.Class({ */ getDuration: function() { if(this._sgNode) { - this._sgNode.duration(); + return this._sgNode.duration(); } return -1; }, diff --git a/cocos2d/core/videoplayer/CCSGVideoPlayer.js b/cocos2d/core/videoplayer/CCSGVideoPlayer.js index ed81f7bc2e..64dad7323e 100644 --- a/cocos2d/core/videoplayer/CCSGVideoPlayer.js +++ b/cocos2d/core/videoplayer/CCSGVideoPlayer.js @@ -77,6 +77,10 @@ _ccsg.VideoPlayer = _ccsg.Node.extend(/** @lends _ccsg.VideoPlayer# */{ return this._renderCmd.duration(); }, + currentTime: function() { + return this._renderCmd.currentTime(); + }, + createDomElementIfNeeded: function () { if (!this._renderCmd._video) { this._renderCmd.createDom(); @@ -516,9 +520,16 @@ _ccsg.VideoPlayer.EventType = { proto.duration = function () { var video = this._video; - if(!video) return; + if(!video) return -1; return video.duration; }; + proto.currentTime = function () { + var video = this._video; + if(!video) return -1; + + return video.currentTime; + }; + })(_ccsg.VideoPlayer._polyfill);