boss-web-player-sdk 1.1.12 → 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.
@@ -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(null), t.cues) {
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, "video/mp4"), i = new window.chrome.cast.media.LoadRequest(r);
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,7 @@ 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);
19122
- let n = this.isTimeInAdBreak(t);
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)), n) this.subtitles.setCustomSubtitleText("");
19125
+ if (e.seeking || (this.lastPlaybackPos = t), this.chapters.updateTime(t), this.refreshAdBreakState(t), this.isAdBreak) this.subtitles.setCustomSubtitleText("");
19124
19126
  else if (this.subtitles.updateTime(this.videoTimeToContentTime(t)), this.hlsActiveSubtitleKey !== null) {
19125
19127
  let e = (this.hlsSubtitleCues.get(this.hlsActiveSubtitleKey) ?? []).filter((e) => t >= e.startTime && t < e.endTime);
19126
19128
  this.subtitles.setCustomSubtitleText(e.map((e) => e.text).join("<br />"));
@@ -19186,7 +19188,7 @@ var wu = class {
19186
19188
  });
19187
19189
  };
19188
19190
  e.addEventListener("loadedmetadata", () => {
19189
- this.analytics.track("video_loaded", e, this.getAnalyticsPayload());
19191
+ this.analytics.track("video_loaded", e, this.getAnalyticsPayload()), this.refreshAdBreakState(e.currentTime);
19190
19192
  let r = 0, i = this.hlsInstance ? ["captions"] : ["subtitles", "captions"];
19191
19193
  for (let e = 0; e < t.length; e++) {
19192
19194
  if (!i.includes(t[e].kind)) continue;
@@ -19209,7 +19211,7 @@ var wu = class {
19209
19211
  ...this.getAnalyticsPayload(),
19210
19212
  subtitleEnabled: e !== null,
19211
19213
  subtitleLanguage: e?.lang ?? ""
19212
- }), e === null) {
19214
+ }), e === null || !e.isHls && !e.isNative) {
19213
19215
  if (this.hlsInstance) this.hlsInstance.subtitleTrack = -1;
19214
19216
  else if (t) {
19215
19217
  for (let e = 0; e < t.length; e++) t[e].mode = "disabled", t[e].oncuechange = null;
@@ -19604,7 +19606,7 @@ var wu = class {
19604
19606
  a.ok && (r = await a.text());
19605
19607
  }
19606
19608
  }
19607
- 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);
19608
19610
  } catch (e) {
19609
19611
  console.error("Error parsing manifest ad breaks:", e);
19610
19612
  }
@@ -19689,6 +19691,10 @@ var wu = class {
19689
19691
  isTimeInAdBreak(e) {
19690
19692
  return this.adBreaks.some((t) => e >= t.startTime && e < t.endTime);
19691
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
+ }
19692
19698
  videoTimeToContentTime(e) {
19693
19699
  let t = e;
19694
19700
  for (let n of this.adBreaks) e >= n.endTime ? t -= n.endTime - n.startTime : e >= n.startTime && (t -= e - n.startTime);
@@ -19698,7 +19704,7 @@ var wu = class {
19698
19704
  return this.adBreaks;
19699
19705
  }
19700
19706
  setAdBreaks(e) {
19701
- 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);
19702
19708
  }
19703
19709
  isInAdBreak() {
19704
19710
  return this.isAdBreak;
@@ -19737,4 +19743,4 @@ var wu = class {
19737
19743
  //#endregion
19738
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 };
19739
19745
 
19740
- //# sourceMappingURL=src-DF41hY2C.js.map
19746
+ //# sourceMappingURL=src-CcXy_WIu.js.map