@npo/player 1.22.0 → 1.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/npoplayer.js +12 -7
- package/lib/package.json +1 -1
- package/package.json +1 -1
package/lib/npoplayer.js
CHANGED
|
@@ -85,7 +85,6 @@ export default class NpoPlayer {
|
|
|
85
85
|
if (this.player === null)
|
|
86
86
|
return;
|
|
87
87
|
let prid = (utility.isJWTToken(source) ? this.streamObject?.metadata.prid : source) || 'unknown';
|
|
88
|
-
this.player.off(PlayerEvent.SourceLoaded, getDurationAndStartPlayerTracker);
|
|
89
88
|
let duration = this.player ? this.player.getDuration() : undefined;
|
|
90
89
|
startPlayerTracker(this, utility.validateStreamLength(duration, true), this.version, prid);
|
|
91
90
|
}.bind(this);
|
|
@@ -146,18 +145,24 @@ export default class NpoPlayer {
|
|
|
146
145
|
if (this.isShowingPlayNextScreen) {
|
|
147
146
|
this.hidePlayNextScreen();
|
|
148
147
|
}
|
|
149
|
-
|
|
148
|
+
const initAndStartTracker = () => {
|
|
150
149
|
if (this.player === null)
|
|
151
150
|
return;
|
|
151
|
+
this.player.off(PlayerEvent.SourceLoaded, initAndStartTracker);
|
|
152
|
+
this.player.off(PlayerEvent.AdBreakFinished, initAndStartTracker);
|
|
153
|
+
this.player.off(PlayerEvent.AdError, initAndStartTracker);
|
|
152
154
|
streamDuration = streamDuration == null
|
|
153
|
-
?
|
|
155
|
+
? getDurationAndStartPlayerTracker()
|
|
154
156
|
: startPlayerTracker(this, utility.validateStreamLength(streamDuration, false), this.version, streamPrid);
|
|
157
|
+
};
|
|
158
|
+
if (this.variant !== NpoPlayerUIVariants.AUDIO && (this.streamObject.metadata.hasPreroll !== 'false' || this.streamObject.assets.preroll)) {
|
|
159
|
+
this.player.on(PlayerEvent.AdBreakFinished, initAndStartTracker);
|
|
160
|
+
this.player.on(PlayerEvent.AdError, initAndStartTracker);
|
|
161
|
+
await handlePreRolls(this.player, this.streamObject, this);
|
|
155
162
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
prerollPromise = handlePreRolls(this.player, _streamObject, this);
|
|
163
|
+
else {
|
|
164
|
+
this.player.on(PlayerEvent.SourceLoaded, initAndStartTracker);
|
|
159
165
|
}
|
|
160
|
-
prerollPromise.then(() => initAndStartTracker.bind(this)());
|
|
161
166
|
}
|
|
162
167
|
else {
|
|
163
168
|
this.doError(`Het is niet gelukt de stream op te halen: \n Input is geen valide token of media object.`, 500);
|
package/lib/package.json
CHANGED