@npo/player 1.27.7 → 1.27.8

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 CHANGED
@@ -160,24 +160,35 @@ export default class NpoPlayer {
160
160
  this.sourceConfig = await playerAction.processSourceConfig(this.npoPlayerServices, source, options.sourceConfig ?? {}, this.streamObject, drmType && drmType.length > 0 ? profile.drm : undefined, this.streamOptions, this.version, this.npoTag?.npoTagInstance);
161
161
  this.npoPlayerServices.handleStreamOptions(this.playerContext);
162
162
  await this.npoPlayerServices.verifyDRM(this.playerContext, payload);
163
- const streamDuration = _streamObject.metadata.duration;
163
+ }
164
+ else {
165
+ await this.npoPlayerServices.handleError(this.playerContext, 500);
166
+ }
167
+ const streamDuration = this.streamObject.metadata.duration;
168
+ const initAndStartTracker = () => {
169
+ if (!this.playerContext || !this.player)
170
+ return;
171
+ this.player?.off(PlayerEvent.AdBreakFinished, initAndStartTracker);
172
+ this.player?.off(PlayerEvent.AdError, initAndStartTracker);
164
173
  this.npoPlayerServices.startPlayerTracker({
165
174
  playerContext: this.playerContext,
166
175
  source: source,
167
176
  duration: streamDuration ? Number(streamDuration) : undefined
168
177
  });
169
- }
170
- else {
171
- await this.npoPlayerServices.handleError(this.playerContext, 500);
172
- }
178
+ };
173
179
  this.npoPlayerServices.setupNicamKijkwijzerIcons(this.playerContext);
174
180
  setupMediaSessionActionHandlers(this.player, this.sourceConfig, this.streamObject);
175
181
  this.hidePlayNextScreen();
176
182
  if (this.variant === NpoPlayerUIVariants.DEFAULT &&
177
183
  this.streamObject.metadata.hasPreroll === 'true' &&
178
184
  this.streamObject.assets.preroll) {
185
+ this.player.on(PlayerEvent.AdBreakFinished, initAndStartTracker);
186
+ this.player.on(PlayerEvent.AdError, initAndStartTracker);
179
187
  await this.npoPlayerServices.schedulePreRolls(this.playerContext);
180
188
  }
189
+ else {
190
+ initAndStartTracker();
191
+ }
181
192
  if (this.variant === NpoPlayerUIVariants.VERTICAL) {
182
193
  this.npoPlayerServices.handleVerticalVideoControls(this.playerContext);
183
194
  this.npoPlayerServices.handleVerticalVideoSettings(this.playerContext);
@@ -327,7 +338,6 @@ export default class NpoPlayer {
327
338
  if (this.npoTag != undefined) {
328
339
  clearInterval(this.npoTag.heartbeatInterval);
329
340
  }
330
- this.pause();
331
341
  if (this.playerContext) {
332
342
  this.npoPlayerServices.removeEventListeners(this.playerContext);
333
343
  this.npoPlayerServices.discardAdBreak(this.playerContext);
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npo/player",
3
- "version": "1.27.7",
3
+ "version": "1.27.8",
4
4
  "description": "NPO Player",
5
5
  "author": "Publieke Omroep <player@npo.nl>",
6
6
  "contributors": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npo/player",
3
- "version": "1.27.7",
3
+ "version": "1.27.8",
4
4
  "description": "NPO Player",
5
5
  "author": "Publieke Omroep <player@npo.nl>",
6
6
  "contributors": [