mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-06 03:22:39 +08:00
Merge pull request #1204 from zilongshanren/fix-issue-4048
add ready to play event to videoplayer
This commit is contained in:
@@ -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);
|
||||
},
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user