Skip to content

Commit

Permalink
fix(FEC-9333): when playing a playlist and closing the countdown wind…
Browse files Browse the repository at this point in the history
…ow, the next entry starts automatically (kaltura#405)

* move to `idle` when the postroll (dai) is done
* make sure the engine events fired by the engine itself not by the proxy
  • Loading branch information
yairans authored Oct 10, 2019
1 parent 73d6454 commit 2f68bd0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,8 @@ export default class Player extends FakeEventTarget {
this._appendEngineEl();
} else {
if (this._engine.id === Engine.id) {
this._engine.restore(source, this._config);
// The restoring must be done by the engine itself not by the proxy (engine decorator is exists) to make sure the engine events fired by the engine itself.
this._engine.restore.call(this._engine._engine || this._engine, source, this._config);
} else {
this._engine.destroy();
this._createEngine(Engine, source);
Expand Down
9 changes: 9 additions & 0 deletions src/state/state-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ export default class StateManager {
[Html5EventType.ENDED]: () => {
this._updateState(StateType.IDLE);
this._dispatchEvent();
},
[CustomEventType.PLAYBACK_ENDED]: () => {
this._updateState(StateType.IDLE);
this._dispatchEvent();
}
},
[StateType.PLAYING]: {
Expand All @@ -119,6 +123,10 @@ export default class StateManager {
this._updateState(StateType.IDLE);
this._dispatchEvent();
},
[CustomEventType.PLAYBACK_ENDED]: () => {
this._updateState(StateType.IDLE);
this._dispatchEvent();
},
[Html5EventType.ERROR]: () => {
this._updateState(StateType.IDLE);
this._dispatchEvent();
Expand Down Expand Up @@ -179,6 +187,7 @@ export default class StateManager {
this._eventManager.listen(this._player, Html5EventType.WAITING, this._doTransition.bind(this));
this._eventManager.listen(this._player, Html5EventType.SEEKED, this._doTransition.bind(this));
this._eventManager.listen(this._player, Html5EventType.TIME_UPDATE, this._doTransition.bind(this));
this._eventManager.listen(this._player, CustomEventType.PLAYBACK_ENDED, this._doTransition.bind(this));
}

/**
Expand Down

0 comments on commit 2f68bd0

Please sign in to comment.