Merge pull request #1204 from zilongshanren/fix-issue-4048

add ready to play event to videoplayer
This commit is contained in:
Wang Nan
2016-10-17 14:59:19 +08:00
committed by GitHub
4 changed files with 14 additions and 3 deletions
+5
View File
@@ -259,9 +259,14 @@ var VideoPlayer = cc.Class({
sgNode.setEventListener(EventType.COMPLETED, this.onCompleted.bind(this));
sgNode.setEventListener(EventType.META_LOADED, this.onMetaLoaded.bind(this));
sgNode.setEventListener(EventType.CLICKED, this.onClicked.bind(this));
sgNode.setEventListener(EventType.READY_TO_PLAY, this.onReadyToPlay.bind(this));
}
},
onReadyToPlay: function () {
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, EventType.READY_TO_PLAY);
},
onMetaLoaded: function () {
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, EventType.META_LOADED);
},
+4 -1
View File
@@ -142,7 +142,10 @@ _ccsg.Label = _ccsg.Node.extend({
fontHandle = fontHandle || "";
this._fontHandle = fontHandle;
string = string || "";
if (typeof string !== 'string') {
string = '' + string;
}
this._string = string;
_ccsg.Node.prototype.ctor.call(this);
+3 -1
View File
@@ -196,7 +196,8 @@ _ccsg.VideoPlayer.EventType = {
STOPPED: 2,
COMPLETED: 3,
META_LOADED: 4,
CLICKED: 5
CLICKED: 5,
READY_TO_PLAY: 6
};
(function (video) {
@@ -327,6 +328,7 @@ _ccsg.VideoPlayer.EventType = {
this._loaded = true;
node.setContentSize(node._contentSize.width, node._contentSize.height);
video.currentTime = 0;
node._dispatchEvent(_ccsg.VideoPlayer.EventType.READY_TO_PLAY);
this.updateVisibility();
this.updateMatrix();
}.bind(this);
+2 -1
View File
@@ -49,7 +49,8 @@ cc.VideoPlayer.EventType = {
STOPPED: 2,
COMPLETED: 3,
META_LOADED: 4,
CLICKED: 5
CLICKED: 5,
READY_TO_PLAY: 6
};
cc.WebView.EventType = {