Skip to content

Commit 1ed1fc3

Browse files
author
Germano Fronza
committed
Fix events triggering
1 parent 777b387 commit 1ed1fc3

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/RTMP.as

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ package {
172172

173173
private function playerPlay(url:String=null):void {
174174
if (!mediaElement) {
175-
playbackState = "PLAYING_BUFFERING";
176-
_triggerEvent('statechanged');
177-
178175
if (isLive) {
179176
urlResource = new StreamingURLResource(url, StreamType.LIVE);
180177
} else {
@@ -216,6 +213,10 @@ package {
216213

217214
addChild(mediaContainer);
218215
resize();
216+
217+
playbackState = "PLAYING_BUFFERING";
218+
_triggerEvent('statechanged');
219+
_triggerEvent('playbackready');
219220
} else {
220221
mediaPlayer.play();
221222
}

src/main.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export default class RTMP extends Flash {
8686
Mediator.on(this.uniqueId + ':progress', this.progress, this)
8787
Mediator.on(this.uniqueId + ':timeupdate', this.updateTime, this)
8888
Mediator.on(this.uniqueId + ':statechanged', this.checkState, this)
89+
Mediator.on(this.uniqueId + ':playbackready', this.playbackReady, this)
8990
Mediator.on(this.uniqueId + ':onloaded', this.reporLevels, this)
9091
Mediator.on(this.uniqueId + ':levelChanging', this.levelChanging, this)
9192
Mediator.on(this.uniqueId + ':levelChanged', this.levelChange, this)
@@ -167,6 +168,12 @@ export default class RTMP extends Flash {
167168
checkState() {
168169
super.checkState()
169170

171+
if (this.el.getState() === "PLAYING") {
172+
this.trigger(Events.PLAYBACK_PLAY, this.name)
173+
}
174+
}
175+
176+
playbackReady() {
170177
this.isReady = true
171178
this.trigger(Events.PLAYBACK_READY, this.name)
172179
}

0 commit comments

Comments
 (0)