boss-web-player-sdk 1.1.11 → 1.1.13
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/README.md +18 -18
- package/dist/boss-web-player-sdk.css +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +23 -0
- package/dist/core.js +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +87 -1
- package/dist/index.js +1151 -960
- package/dist/index.js.map +1 -1
- package/dist/{src-a2B5ZIDF.js → src-CcXy_WIu.js} +36 -15
- package/dist/{src-a2B5ZIDF.js.map → src-CcXy_WIu.js.map} +1 -1
- package/dist/{src-CsMBVhOP.cjs → src-ynqyJ4on.cjs} +5 -5
- package/dist/{src-CsMBVhOP.cjs.map → src-ynqyJ4on.cjs.map} +1 -1
- package/package.json +1 -1
|
@@ -18795,7 +18795,7 @@ var wu = class {
|
|
|
18795
18795
|
this.currentCues = [], this.updateActiveText(0), this.onTrackSwitchCallback && this.onTrackSwitchCallback(t);
|
|
18796
18796
|
return;
|
|
18797
18797
|
}
|
|
18798
|
-
if (this.onTrackSwitchCallback && this.onTrackSwitchCallback(
|
|
18798
|
+
if (this.onTrackSwitchCallback && this.onTrackSwitchCallback(t), t.cues) {
|
|
18799
18799
|
this.currentCues = t.cues;
|
|
18800
18800
|
return;
|
|
18801
18801
|
}
|
|
@@ -18867,7 +18867,7 @@ var wu = class {
|
|
|
18867
18867
|
this.config = e;
|
|
18868
18868
|
}
|
|
18869
18869
|
validateDomain(e) {
|
|
18870
|
-
return !this.config || !this.config.allowedDomains || this.config.allowedDomains.length === 0 ? !0 : this.config.allowedDomains.includes(e) || this.config.allowedDomains.some((t) => e.endsWith(t));
|
|
18870
|
+
return !this.config || !this.config.allowedDomains || this.config.allowedDomains.length === 0 ? !0 : this.config.allowedDomains.includes(e) || this.config.allowedDomains.some((t) => e.endsWith(`.${t}`));
|
|
18871
18871
|
}
|
|
18872
18872
|
getAuthToken() {
|
|
18873
18873
|
return this.config?.authToken;
|
|
@@ -18955,6 +18955,10 @@ var wu = class {
|
|
|
18955
18955
|
isMuted: this.remotePlayer.isMuted ?? !1
|
|
18956
18956
|
};
|
|
18957
18957
|
}
|
|
18958
|
+
getContentType(e) {
|
|
18959
|
+
let t = e.split(/[?#]/)[0].toLowerCase();
|
|
18960
|
+
return t.endsWith(".m3u8") ? "application/x-mpegurl" : t.endsWith(".mpd") ? "application/dash+xml" : "video/mp4";
|
|
18961
|
+
}
|
|
18958
18962
|
async requestSession(e, t) {
|
|
18959
18963
|
if (!this.castContext) {
|
|
18960
18964
|
console.error("[PlayerSDK Cast] Google Cast Framework not loaded.");
|
|
@@ -18964,7 +18968,7 @@ var wu = class {
|
|
|
18964
18968
|
await this.castContext.requestSession();
|
|
18965
18969
|
let n = this.castContext.getCurrentSession();
|
|
18966
18970
|
if (n && e) {
|
|
18967
|
-
let r = new window.chrome.cast.media.MediaInfo(e,
|
|
18971
|
+
let r = new window.chrome.cast.media.MediaInfo(e, this.getContentType(e)), i = new window.chrome.cast.media.LoadRequest(r);
|
|
18968
18972
|
i.currentTime = t, i.autoplay = !0, await n.loadMedia(i);
|
|
18969
18973
|
}
|
|
18970
18974
|
} catch (e) {
|
|
@@ -19118,9 +19122,8 @@ var wu = class {
|
|
|
19118
19122
|
this.progressTick++;
|
|
19119
19123
|
}), e.addEventListener("timeupdate", () => {
|
|
19120
19124
|
let t = e.currentTime;
|
|
19121
|
-
e.seeking || (this.lastPlaybackPos = t), this.chapters.updateTime(t), this.subtitles.
|
|
19122
|
-
|
|
19123
|
-
if (n !== this.isAdBreak && (this.isAdBreak = n, this.analytics.setAdBreak(n, e), n ? (this.contentPlaybackRate = e.playbackRate, e.playbackRate = 1) : e.playbackRate = this.contentPlaybackRate, this.emit("adbreakchange", n)), this.hlsActiveSubtitleKey !== null) {
|
|
19125
|
+
if (e.seeking || (this.lastPlaybackPos = t), this.chapters.updateTime(t), this.refreshAdBreakState(t), this.isAdBreak) this.subtitles.setCustomSubtitleText("");
|
|
19126
|
+
else if (this.subtitles.updateTime(this.videoTimeToContentTime(t)), this.hlsActiveSubtitleKey !== null) {
|
|
19124
19127
|
let e = (this.hlsSubtitleCues.get(this.hlsActiveSubtitleKey) ?? []).filter((e) => t >= e.startTime && t < e.endTime);
|
|
19125
19128
|
this.subtitles.setCustomSubtitleText(e.map((e) => e.text).join("<br />"));
|
|
19126
19129
|
}
|
|
@@ -19165,7 +19168,9 @@ var wu = class {
|
|
|
19165
19168
|
let t = e.error;
|
|
19166
19169
|
this.analytics.track("error", e, {
|
|
19167
19170
|
...this.getAnalyticsPayload(),
|
|
19168
|
-
errorMessage: t ? `${t.code}: ${t.message}` : "Unknown HTML5 video playback error"
|
|
19171
|
+
errorMessage: t ? `${t.code}: ${t.message}` : "Unknown HTML5 video playback error",
|
|
19172
|
+
errorCode: t?.code,
|
|
19173
|
+
isRecoverable: !1
|
|
19169
19174
|
}), this.fail(t instanceof Error ? t : /* @__PURE__ */ Error(t ? `${t.code}: ${t.message}` : "Unknown HTML5 video playback error"));
|
|
19170
19175
|
});
|
|
19171
19176
|
let t = e.textTracks;
|
|
@@ -19183,7 +19188,7 @@ var wu = class {
|
|
|
19183
19188
|
});
|
|
19184
19189
|
};
|
|
19185
19190
|
e.addEventListener("loadedmetadata", () => {
|
|
19186
|
-
this.analytics.track("video_loaded", e, this.getAnalyticsPayload());
|
|
19191
|
+
this.analytics.track("video_loaded", e, this.getAnalyticsPayload()), this.refreshAdBreakState(e.currentTime);
|
|
19187
19192
|
let r = 0, i = this.hlsInstance ? ["captions"] : ["subtitles", "captions"];
|
|
19188
19193
|
for (let e = 0; e < t.length; e++) {
|
|
19189
19194
|
if (!i.includes(t[e].kind)) continue;
|
|
@@ -19206,7 +19211,7 @@ var wu = class {
|
|
|
19206
19211
|
...this.getAnalyticsPayload(),
|
|
19207
19212
|
subtitleEnabled: e !== null,
|
|
19208
19213
|
subtitleLanguage: e?.lang ?? ""
|
|
19209
|
-
}), e === null) {
|
|
19214
|
+
}), e === null || !e.isHls && !e.isNative) {
|
|
19210
19215
|
if (this.hlsInstance) this.hlsInstance.subtitleTrack = -1;
|
|
19211
19216
|
else if (t) {
|
|
19212
19217
|
for (let e = 0; e < t.length; e++) t[e].mode = "disabled", t[e].oncuechange = null;
|
|
@@ -19217,6 +19222,10 @@ var wu = class {
|
|
|
19217
19222
|
t[n].mode = "hidden";
|
|
19218
19223
|
let e = t[n];
|
|
19219
19224
|
e.oncuechange = () => {
|
|
19225
|
+
if (this.isAdBreak) {
|
|
19226
|
+
this.subtitles.setCustomSubtitleText("");
|
|
19227
|
+
return;
|
|
19228
|
+
}
|
|
19220
19229
|
let t = e.activeCues;
|
|
19221
19230
|
if (t && t.length > 0) {
|
|
19222
19231
|
let e = Array.from(t).map((e) => e.text).join("<br />");
|
|
@@ -19315,7 +19324,8 @@ var wu = class {
|
|
|
19315
19324
|
n && (this.analytics.track("quality_change", this.videoElement, {
|
|
19316
19325
|
...this.getAnalyticsPayload(),
|
|
19317
19326
|
rendition: n.label,
|
|
19318
|
-
bitrate: n.bitrate
|
|
19327
|
+
bitrate: n.bitrate,
|
|
19328
|
+
isAutoSwitch: r.autoLevelEnabled
|
|
19319
19329
|
}), this.emit("qualitychange", n));
|
|
19320
19330
|
}), r.on($.Events.ERROR, (t, n) => {
|
|
19321
19331
|
let i = n.response?.code;
|
|
@@ -19323,14 +19333,16 @@ var wu = class {
|
|
|
19323
19333
|
this.analytics.track("network_error", this.videoElement, {
|
|
19324
19334
|
...this.getAnalyticsPayload(),
|
|
19325
19335
|
errorMessage: n.details,
|
|
19326
|
-
errorCode: i
|
|
19336
|
+
errorCode: i,
|
|
19337
|
+
isRecoverable: !1
|
|
19327
19338
|
}), this.fail(/* @__PURE__ */ Error(`Network error ${i}: ${n.details}`));
|
|
19328
19339
|
return;
|
|
19329
19340
|
}
|
|
19330
19341
|
n.fatal && (n.type === $.ErrorTypes.NETWORK_ERROR ? (this.analytics.track("network_error", this.videoElement, {
|
|
19331
19342
|
...this.getAnalyticsPayload(),
|
|
19332
19343
|
errorMessage: n.details,
|
|
19333
|
-
errorCode: i ?? 0
|
|
19344
|
+
errorCode: i ?? 0,
|
|
19345
|
+
isRecoverable: this.networkErrorRetries < e.MAX_NETWORK_RETRIES
|
|
19334
19346
|
}), this.networkErrorRetries < e.MAX_NETWORK_RETRIES ? (this.networkErrorRetries++, r.startLoad()) : this.fail(/* @__PURE__ */ Error(`Network error: ${n.details}`))) : n.type === $.ErrorTypes.MEDIA_ERROR ? this.mediaErrorRecovered ? this.fail(/* @__PURE__ */ Error(`Media error: ${n.details}`)) : (this.mediaErrorRecovered = !0, r.recoverMediaError()) : this.fail(/* @__PURE__ */ Error(`Playback error: ${n.details}`)));
|
|
19335
19347
|
});
|
|
19336
19348
|
} else this.videoElement.canPlayType("application/vnd.apple.mpegurl") && (this.videoElement.src = t, this.qualityLevels = [{
|
|
@@ -19594,7 +19606,7 @@ var wu = class {
|
|
|
19594
19606
|
a.ok && (r = await a.text());
|
|
19595
19607
|
}
|
|
19596
19608
|
}
|
|
19597
|
-
this.adBreaks = this.parseAdBreaksFromPlaylist(r), this.analytics.setAdBreaks(this.adBreaks), this.adBreaks.length > 0 && this.emit("adbreaksloaded", this.adBreaks);
|
|
19609
|
+
this.adBreaks = this.parseAdBreaksFromPlaylist(r), this.analytics.setAdBreaks(this.adBreaks), this.adBreaks.length > 0 && this.emit("adbreaksloaded", this.adBreaks), this.refreshAdBreakState(this.videoElement.currentTime);
|
|
19598
19610
|
} catch (e) {
|
|
19599
19611
|
console.error("Error parsing manifest ad breaks:", e);
|
|
19600
19612
|
}
|
|
@@ -19679,11 +19691,20 @@ var wu = class {
|
|
|
19679
19691
|
isTimeInAdBreak(e) {
|
|
19680
19692
|
return this.adBreaks.some((t) => e >= t.startTime && e < t.endTime);
|
|
19681
19693
|
}
|
|
19694
|
+
refreshAdBreakState(e) {
|
|
19695
|
+
let t = this.videoElement, n = this.isTimeInAdBreak(e);
|
|
19696
|
+
n !== this.isAdBreak && (this.isAdBreak = n, this.analytics.setAdBreak(n, t), n ? (this.contentPlaybackRate = t.playbackRate, t.playbackRate = 1) : t.playbackRate = this.contentPlaybackRate, this.emit("adbreakchange", n));
|
|
19697
|
+
}
|
|
19698
|
+
videoTimeToContentTime(e) {
|
|
19699
|
+
let t = e;
|
|
19700
|
+
for (let n of this.adBreaks) e >= n.endTime ? t -= n.endTime - n.startTime : e >= n.startTime && (t -= e - n.startTime);
|
|
19701
|
+
return Math.max(0, t);
|
|
19702
|
+
}
|
|
19682
19703
|
getAdBreaks() {
|
|
19683
19704
|
return this.adBreaks;
|
|
19684
19705
|
}
|
|
19685
19706
|
setAdBreaks(e) {
|
|
19686
|
-
this.adBreaks = e, this.analytics.setAdBreaks(e), this.emit("adbreaksloaded", e);
|
|
19707
|
+
this.adBreaks = e, this.analytics.setAdBreaks(e), this.emit("adbreaksloaded", e), this.refreshAdBreakState(this.videoElement.currentTime);
|
|
19687
19708
|
}
|
|
19688
19709
|
isInAdBreak() {
|
|
19689
19710
|
return this.isAdBreak;
|
|
@@ -19722,4 +19743,4 @@ var wu = class {
|
|
|
19722
19743
|
//#endregion
|
|
19723
19744
|
export { Au as a, Du as c, ju as i, wu as l, Nu as n, ku as o, Mu as r, Ou as s, Pu as t, $ as u };
|
|
19724
19745
|
|
|
19725
|
-
//# sourceMappingURL=src-
|
|
19746
|
+
//# sourceMappingURL=src-CcXy_WIu.js.map
|