mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 00:22:43 +08:00
fix currentTime and duration
This commit is contained in:
@@ -326,7 +326,7 @@ var VideoPlayer = cc.Class({
|
||||
*/
|
||||
getDuration: function() {
|
||||
if(this._sgNode) {
|
||||
this._sgNode.duration();
|
||||
return this._sgNode.duration();
|
||||
}
|
||||
return -1;
|
||||
},
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user