@npo/player 1.22.0 → 1.22.2
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 +13 -8
- 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);
|
|
@@ -138,7 +137,6 @@ export default class NpoPlayer {
|
|
|
138
137
|
return;
|
|
139
138
|
const drmType = this.streamObject.stream.drmType ?? null;
|
|
140
139
|
this.sourceConfig = await playerAction.processSourceConfig(options.sourceConfig ?? {}, this.streamObject, drmType && drmType.length > 0 ? profile.drm : null, this.streamOptions, this.version, this.npoTag?.npoTagInstance?.getParty());
|
|
141
|
-
await drm.verifyDRM(this, this.player, payload);
|
|
142
140
|
setupMediaSessionActionHandlers(this.player, this.sourceConfig, _streamObject);
|
|
143
141
|
logEvent(this, 'load');
|
|
144
142
|
let streamDuration = _streamObject.metadata.duration;
|
|
@@ -146,18 +144,25 @@ export default class NpoPlayer {
|
|
|
146
144
|
if (this.isShowingPlayNextScreen) {
|
|
147
145
|
this.hidePlayNextScreen();
|
|
148
146
|
}
|
|
149
|
-
|
|
147
|
+
const initAndStartTracker = () => {
|
|
150
148
|
if (this.player === null)
|
|
151
149
|
return;
|
|
150
|
+
this.player.off(PlayerEvent.SourceLoaded, initAndStartTracker);
|
|
151
|
+
this.player.off(PlayerEvent.AdBreakFinished, initAndStartTracker);
|
|
152
|
+
this.player.off(PlayerEvent.AdError, initAndStartTracker);
|
|
152
153
|
streamDuration = streamDuration == null
|
|
153
|
-
?
|
|
154
|
+
? getDurationAndStartPlayerTracker()
|
|
154
155
|
: startPlayerTracker(this, utility.validateStreamLength(streamDuration, false), this.version, streamPrid);
|
|
156
|
+
};
|
|
157
|
+
if (this.variant !== NpoPlayerUIVariants.AUDIO && (this.streamObject.metadata.hasPreroll !== 'false' || this.streamObject.assets.preroll)) {
|
|
158
|
+
this.player.on(PlayerEvent.AdBreakFinished, initAndStartTracker);
|
|
159
|
+
this.player.on(PlayerEvent.AdError, initAndStartTracker);
|
|
160
|
+
await handlePreRolls(this.player, this.streamObject, this);
|
|
155
161
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
prerollPromise = handlePreRolls(this.player, _streamObject, this);
|
|
162
|
+
else {
|
|
163
|
+
this.player.on(PlayerEvent.SourceLoaded, initAndStartTracker);
|
|
159
164
|
}
|
|
160
|
-
|
|
165
|
+
await drm.verifyDRM(this, this.player, payload);
|
|
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