@npo/player 1.22.3 → 1.22.5
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/js/ads/ster.js +3 -3
- package/lib/npoplayer.js +11 -12
- package/lib/package.json +1 -1
- package/package.json +1 -1
package/lib/js/ads/ster.js
CHANGED
|
@@ -11,8 +11,8 @@ export async function handlePreRolls(playerapi, streamObject, npoplayer) {
|
|
|
11
11
|
let totalAds = 0;
|
|
12
12
|
let currentClickListener = null;
|
|
13
13
|
let adUiSet = false;
|
|
14
|
-
async function
|
|
15
|
-
playerapi.off(PlayerEvent.
|
|
14
|
+
async function handleReady() {
|
|
15
|
+
playerapi.off(PlayerEvent.Ready, handleReady);
|
|
16
16
|
const advertConfig = {
|
|
17
17
|
tag: {
|
|
18
18
|
url: String(prerollUrl),
|
|
@@ -23,7 +23,7 @@ export async function handlePreRolls(playerapi, streamObject, npoplayer) {
|
|
|
23
23
|
};
|
|
24
24
|
await playerapi.ads.schedule(advertConfig);
|
|
25
25
|
}
|
|
26
|
-
playerapi.on(PlayerEvent.
|
|
26
|
+
playerapi.on(PlayerEvent.Ready, handleReady);
|
|
27
27
|
async function handlePlay() {
|
|
28
28
|
playerapi.off(PlayerEvent.Play, handlePlay);
|
|
29
29
|
attemptSetAdUi();
|
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,31 +137,31 @@ 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());
|
|
140
|
+
await drm.verifyDRM(this, this.player, payload);
|
|
141
|
+
setupMediaSessionActionHandlers(this.player, this.sourceConfig, _streamObject);
|
|
142
|
+
logEvent(this, 'load');
|
|
143
|
+
let streamDuration = _streamObject.metadata.duration;
|
|
144
|
+
let streamPrid = this.streamObject.metadata.prid || _streamObject.metadata.prid;
|
|
145
|
+
if (this.isShowingPlayNextScreen) {
|
|
146
|
+
this.hidePlayNextScreen();
|
|
147
|
+
}
|
|
141
148
|
const initAndStartTracker = () => {
|
|
142
149
|
if (this.player === null)
|
|
143
150
|
return;
|
|
144
|
-
this.player.off(PlayerEvent.
|
|
151
|
+
this.player.off(PlayerEvent.Ready, initAndStartTracker);
|
|
145
152
|
this.player.off(PlayerEvent.AdBreakFinished, initAndStartTracker);
|
|
146
153
|
this.player.off(PlayerEvent.AdError, initAndStartTracker);
|
|
147
154
|
streamDuration = streamDuration == null
|
|
148
155
|
? getDurationAndStartPlayerTracker()
|
|
149
156
|
: startPlayerTracker(this, utility.validateStreamLength(streamDuration, false), this.version, streamPrid);
|
|
150
157
|
};
|
|
151
|
-
if (this.variant !== NpoPlayerUIVariants.AUDIO &&
|
|
158
|
+
if (this.variant !== NpoPlayerUIVariants.AUDIO && this.streamObject.metadata.hasPreroll === 'true' && this.streamObject.assets.preroll) {
|
|
152
159
|
this.player.on(PlayerEvent.AdBreakFinished, initAndStartTracker);
|
|
153
160
|
this.player.on(PlayerEvent.AdError, initAndStartTracker);
|
|
154
161
|
await handlePreRolls(this.player, this.streamObject, this);
|
|
155
162
|
}
|
|
156
163
|
else {
|
|
157
|
-
this.player.on(PlayerEvent.
|
|
158
|
-
}
|
|
159
|
-
await drm.verifyDRM(this, this.player, payload);
|
|
160
|
-
setupMediaSessionActionHandlers(this.player, this.sourceConfig, _streamObject);
|
|
161
|
-
logEvent(this, 'load');
|
|
162
|
-
let streamDuration = _streamObject.metadata.duration;
|
|
163
|
-
let streamPrid = this.streamObject.metadata.prid || _streamObject.metadata.prid;
|
|
164
|
-
if (this.isShowingPlayNextScreen) {
|
|
165
|
-
this.hidePlayNextScreen();
|
|
164
|
+
this.player.on(PlayerEvent.Ready, initAndStartTracker);
|
|
166
165
|
}
|
|
167
166
|
}
|
|
168
167
|
else {
|
package/lib/package.json
CHANGED