-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: engine decorator #324
Conversation
src/base-engine-decorator.js
Outdated
import {EventType} from './event/event-type'; | ||
import EventManager from './event/event-manager'; | ||
|
||
class BaseEngineDecorator extends FakeEventTarget { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add implements IEngine
@@ -1609,6 +1628,14 @@ export default class Player extends FakeEventTarget { | |||
this._onTextTrackChanged(event) | |||
); | |||
this._eventManager.listen(this._externalCaptionsHandler, Html5EventType.ERROR, (event: FakeEvent) => this.dispatchEvent(event)); | |||
if (this._adsController) { | |||
this._eventManager.listen(this._adsController, AdEventType.AD_BREAK_START, () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an issue with poster and ima-dai prerolls when autoplay=false (the poster is flashing before the preroll).
This logic comes to fix it.
Hi @dan-ziv, |
@@ -273,6 +273,9 @@ export default class NativeAdapter extends BaseMediaSourceAdapter { | |||
this._eventManager.listen(this._videoElement, Html5EventType.ENDED, () => this._clearHeartbeatTimeout()); | |||
this._eventManager.listen(this._videoElement, Html5EventType.ABORT, () => this._clearHeartbeatTimeout()); | |||
this._eventManager.listen(this._videoElement, Html5EventType.SEEKED, () => this._onSeeked()); | |||
// Sometimes when playing live in safari and switching between tabs the currentTime goes back with no seek events | |||
this._eventManager.listen(window, 'focus', () => setTimeout(() => this._onSeeked(), 1000)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to think if all of this check is relevant for live, so check if we even detect stalling/waiting when doing throttling test.
If we don't then just cancel the onTimeUpdate check when we are in live.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. onTimeUpdate
check is relevant for live as well.
We have to detect internet disconnection for live to get an error like in chrome
@@ -367,6 +372,31 @@ export default class NativeAdapter extends BaseMediaSourceAdapter { | |||
} | |||
} | |||
|
|||
_handleMetadataTrackEvents(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to move this to html5 layer so it will be generic timed_metadata event.
} else { | ||
Array.from(this._videoElement.textTracks).forEach((track: TextTrack) => { | ||
if (track.kind === 'metadata') { | ||
setTimeout(() => (track.mode = 'hidden'), 100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
100 to const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add comment
src/base-engine-decorator.js
Outdated
@@ -0,0 +1,282 @@ | |||
// @flow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check to minimise the code
Description of the Changes
Engine decorator framework which will serve DAI use-cases.
The engine decorator will catch any API call to the engine and will decide what do to depends on its logic.
Plugin who wants to implement an engine decorator will need to have the signature:
The BaseEngineDecorator redirects each API call to the engine itself, so if plugin won't implement certain API call, by default it will bubble to the engine.
When an engine is chosen, the player will check if certain plugin implemented getEngineDecorator. If such exists, it will pass it the engine and will get the decorator instead.
CheckLists