@eluvio/elv-player-js 2.1.26 → 2.1.29

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.
@@ -21656,17 +21656,17 @@ class Iq {
21656
21656
  }, this.ready = !0, this.playoutUrl && this.onReady && this.onReady();
21657
21657
  }
21658
21658
  async SetMedia({ playoutOptions: e, playoutParameters: t }) {
21659
- let a = ((e || {}).dash || {}).playoutMethods || {}, s = a.clear;
21659
+ let a = ((e || {}).dash || {}).playoutMethods || {}, s = a.clear || a.widevine;
21660
21660
  if (!s)
21661
21661
  try {
21662
21662
  e = await (await this.player.__Client()).PlayoutOptions({
21663
21663
  ...t,
21664
21664
  offering: "default_dash"
21665
- }), a = ((e || {}).dash || {}).playoutMethods || {}, s = a.clear || {};
21665
+ }), a = ((e || {}).dash || {}).playoutMethods || {}, s = a.clear || a.widevine || {};
21666
21666
  } catch {
21667
21667
  this.player.Log("Unable to find dash playout options for chromecast");
21668
21668
  }
21669
- this.playoutUrl = (s || {}).playoutUrl, this.playoutUrl && this.ready && this.onReady && this.onReady();
21669
+ this.playoutUrl = (s || {}).playoutUrl, console.log("Chromecast Playout URL: ", this.playoutUrl), this.playoutUrl && this.ready && this.onReady && this.onReady();
21670
21670
  }
21671
21671
  async Start() {
21672
21672
  this.player && this.player.__SetCasting(!0);
@@ -50039,7 +50039,7 @@ function VP() {
50039
50039
  ElvCrypto: async () => {
50040
50040
  try {
50041
50041
  if (!a.elvCrypto) {
50042
- const s = (await import("./index-DIMPV66P.mjs")).default;
50042
+ const s = (await import("./index-D31_YQxo.mjs")).default;
50043
50043
  a.elvCrypto = await new s().init();
50044
50044
  }
50045
50045
  return a.elvCrypto;
@@ -66073,12 +66073,12 @@ class pee {
66073
66073
  active: this.player.hlsPlayer.autoLevelEnabled
66074
66074
  });
66075
66075
  }
66076
- } else this.player.dashPlayer && (e = this.player.dashPlayer.getBitrateInfoListFor("video").map((t) => ({
66077
- index: t.qualityIndex,
66078
- active: t.qualityIndex === this.player.dashPlayer.getQualityFor("video"),
66076
+ } else this.player.dashPlayer && (e = this.player.dashPlayer.getRepresentationsByType("video").map((t) => ({
66077
+ index: t.index,
66078
+ active: t.index === this.player.dashPlayer.getCurrentRepresentationForType("video").index,
66079
66079
  resolution: `${t.width}x${t.height}`,
66080
- bitrate: t.bitrate,
66081
- label: `${t.width}x${t.height} (${(t.bitrate / 1e3 / 1e3).toFixed(1)}Mbps)`,
66080
+ bitrate: t.bitrateInKbit * 1e3,
66081
+ label: `${t.width}x${t.height} (${(t.bitrateInKbit / 1e3).toFixed(1)}Mbps)`,
66082
66082
  activeLabel: `${t.width}x${t.height}`
66083
66083
  })).sort((t, a) => t.bitrate < a.bitrate ? 1 : -1));
66084
66084
  return {
@@ -66094,7 +66094,7 @@ class pee {
66094
66094
  * @param levelIndex - The index of the quality level to set
66095
66095
  */
66096
66096
  SetQualityLevel(e) {
66097
- this.player.hlsPlayer ? (this.player.hlsPlayer.nextLevel = e, this.player.hlsPlayer.streamController.immediateLevelSwitch()) : this.player.dashPlayer && (this.player.dashPlayer.setQualityFor("video", e), this.player.dashPlayer.updateSettings({
66097
+ this.player.hlsPlayer ? (this.player.hlsPlayer.nextLevel = e, this.player.hlsPlayer.streamController.immediateLevelSwitch()) : this.player.dashPlayer && (this.player.dashPlayer.setRepresentationForTypeByIndex("video", e), this.player.dashPlayer.updateSettings({
66098
66098
  streaming: {
66099
66099
  trackSwitchMode: "alwaysReplace",
66100
66100
  buffer: {
@@ -67058,8 +67058,8 @@ class Kw {
67058
67058
  async __PlayoutOptions() {
67059
67059
  const e = await this.__Client(), t = this.sourceOptions.playoutParameters || {};
67060
67060
  if (this.collectionInfo) {
67061
- const M = this.collectionInfo.content[this.collectionInfo.mediaIndex];
67062
- t.objectId = e.utils.DecodeVersionHash(M.mediaHash).objectId, t.versionHash = M.mediaHash, this.sourceOptions.playoutOptions = void 0;
67061
+ const R = this.collectionInfo.content[this.collectionInfo.mediaIndex];
67062
+ t.objectId = e.utils.DecodeVersionHash(R.mediaHash).objectId, t.versionHash = R.mediaHash, this.sourceOptions.playoutOptions = void 0;
67063
67063
  }
67064
67064
  let a, s, u = {
67065
67065
  ignore_trimming: t.ignoreTrimming,
@@ -67069,7 +67069,7 @@ class Kw {
67069
67069
  clip_end: (t.options || {}).clip_end || t.clipEnd
67070
67070
  }, o, c;
67071
67071
  if ((u.clip_start || u.clip_end) && (o = parseFloat(u.clip_start || 0), c = parseFloat(u.clip_end || 0), delete u.clip_start, delete u.clip_end), !t.channel) {
67072
- let M = await e.AvailableOfferings({
67072
+ let R = await e.AvailableOfferings({
67073
67073
  objectId: t.objectId,
67074
67074
  versionHash: t.versionHash,
67075
67075
  writeToken: t.writeToken,
@@ -67078,53 +67078,53 @@ class Kw {
67078
67078
  resolveIncludeSource: !0,
67079
67079
  authorizationToken: t.authorizationToken
67080
67080
  }) || {};
67081
- if (a = M.default ? "default" : Object.keys(M)[0], t.offering ? a = M[t.offering] ? t.offering : void 0 : (t.offerings || []).length > 0 ? a = t.offerings.find((O) => M[O]) : t.offerings && t.offerings.length > 0 && (a = t.offerings.find((O) => M[O])), !a)
67081
+ if (a = R.default ? "default" : Object.keys(R)[0], t.offering ? a = R[t.offering] ? t.offering : void 0 : (t.offerings || []).length > 0 ? a = t.offerings.find((W) => R[W]) : t.offerings && t.offerings.length > 0 && (a = t.offerings.find((W) => R[W])), !a)
67082
67082
  throw new Error(`Unable to find offering from '${t.offering || t.offerings}'`);
67083
- const R = M[a] && M[a].properties || {};
67084
- s = M[a].uri, this.sourceOptions.contentInfo.liveDVR === $t.liveDVR.ON && R.dvr_available ? (u.dvr = 1, this.dvrAvailable = !0) : this.dvrAvailable = !1, this.isLive = R.live;
67083
+ const O = R[a] && R[a].properties || {};
67084
+ s = R[a].uri, this.sourceOptions.contentInfo.liveDVR === $t.liveDVR.ON && O.dvr_available ? (u.dvr = 1, this.dvrAvailable = !0) : this.dvrAvailable = !1, this.isLive = O.live;
67085
67085
  }
67086
- const p = async (M) => t.directLink ? await e.PlayoutOptions({
67086
+ const p = async (R) => t.directLink ? await e.PlayoutOptions({
67087
67087
  offeringURI: s,
67088
- options: M
67088
+ options: R
67089
67089
  }) : await e.PlayoutOptions({
67090
67090
  ...t,
67091
67091
  handler: t.channel ? "channel" : "playout",
67092
67092
  offering: t.channel || a,
67093
- options: M
67093
+ options: R
67094
67094
  });
67095
67095
  if (!this.sourceOptions.playoutOptions) {
67096
- let M;
67096
+ let R;
67097
67097
  if (!o && !c)
67098
- M = await p(u);
67098
+ R = await p(u);
67099
67099
  else if (!t.clipRelativeToUntrimmed)
67100
- M = await p({
67100
+ R = await p({
67101
67101
  ...u,
67102
67102
  clip_start: o,
67103
67103
  clip_end: c
67104
67104
  });
67105
67105
  else {
67106
- M = await p(u);
67107
- let R;
67106
+ R = await p(u);
67107
+ let O;
67108
67108
  try {
67109
- for (const O of Object.keys(M || {})) {
67110
- for (const W of Object.keys(M[O].playoutMethods || {}))
67111
- if (typeof (M[O].playoutMethods[W].properties || {}).start_offset_float < "u") {
67112
- R = parseFloat(M[O].playoutMethods[W].properties.start_offset_float);
67109
+ for (const W of Object.keys(R || {})) {
67110
+ for (const Z of Object.keys(R[W].playoutMethods || {}))
67111
+ if (typeof (R[W].playoutMethods[Z].properties || {}).start_offset_float < "u") {
67112
+ O = parseFloat(R[W].playoutMethods[Z].properties.start_offset_float);
67113
67113
  break;
67114
67114
  }
67115
- if (typeof R < "u")
67115
+ if (typeof O < "u")
67116
67116
  break;
67117
67117
  }
67118
- } catch (O) {
67119
- this.Log("Failed to load content offset for clip adjustment:"), this.Log(O, !0);
67118
+ } catch (W) {
67119
+ this.Log("Failed to load content offset for clip adjustment:"), this.Log(W, !0);
67120
67120
  }
67121
- M = await p({
67121
+ R = await p({
67122
67122
  ...u,
67123
- clip_start: (o || 0) - (R || 0),
67124
- clip_end: (c || 0) - (R || 0) || 9999999
67123
+ clip_start: (o || 0) - (O || 0),
67124
+ clip_end: (c || 0) - (O || 0) || 9999999
67125
67125
  });
67126
67126
  }
67127
- this.sourceOptions.playoutOptions = M;
67127
+ this.sourceOptions.playoutOptions = R;
67128
67128
  }
67129
67129
  t.directLink ? this.sourceOptions.playoutOptions || (this.sourceOptions.playoutOptions = await e.PlayoutOptions({
67130
67130
  offeringURI: s,
@@ -67135,14 +67135,14 @@ class Kw {
67135
67135
  offering: t.channel || a,
67136
67136
  options: u
67137
67137
  }));
67138
- let d = (await e.AvailableDRMs()).filter((M) => (this.sourceOptions.drms || []).includes(M)), y = this.sourceOptions.protocols, m, v;
67138
+ let d = (await e.AvailableDRMs()).filter((R) => (this.sourceOptions.drms || []).includes(R)), y = this.sourceOptions.protocols, m, v;
67139
67139
  for (; !(m && v); ) {
67140
- m = y.find((R) => this.sourceOptions.playoutOptions[R]);
67141
- const M = Object.keys(this.sourceOptions.playoutOptions[m].playoutMethods);
67142
- if (v = (this.sourceOptions.drms || []).length === 0 ? M.find((R) => R !== "clear") || M[0] : this.sourceOptions.drms.sort().reverse().find((R) => d.includes(R) && this.sourceOptions.playoutOptions[m].playoutMethods[R]), !v && (y = y.filter((R) => R !== m), y.length === 0))
67140
+ m = y.find((O) => this.sourceOptions.playoutOptions[O]);
67141
+ const R = Object.keys(this.sourceOptions.playoutOptions[m].playoutMethods);
67142
+ if (v = (this.sourceOptions.drms || []).length === 0 ? R.find((O) => O !== "clear") || R[0] : this.sourceOptions.drms.sort().reverse().find((O) => d.includes(O) && this.sourceOptions.playoutOptions[m].playoutMethods[O]), !v && (y = y.filter((O) => O !== m), y.length === 0))
67143
67143
  throw Error("No valid protocol / DRM combination available");
67144
67144
  }
67145
- const { playoutUrl: b, drms: x, thumbnailTrack: E, properties: C } = this.sourceOptions.playoutOptions[m].playoutMethods[v], T = b.split("/").find((M) => M.startsWith("hq__")), k = (C || {}).start_offset_float || 0;
67145
+ const { playoutUrl: b, drms: x, thumbnailTrack: E, properties: C } = this.sourceOptions.playoutOptions[m].playoutMethods[v], T = b.split("/").find((R) => R.startsWith("hq__")), k = (C || {}).start_offset_float || 0, M = (o || 0) + (k || 0);
67146
67146
  return {
67147
67147
  playoutParameters: {
67148
67148
  ...t,
@@ -67162,6 +67162,7 @@ class Kw {
67162
67162
  clipStart: u.clip_start,
67163
67163
  clipEnd: u.clip_end,
67164
67164
  trimOffset: k,
67165
+ thumbnailOffset: M,
67165
67166
  sessionId: this.sourceOptions.playoutOptions.sessionId,
67166
67167
  multiviewOptions: {
67167
67168
  enabled: this.sourceOptions.playoutOptions.multiview,
@@ -67231,8 +67232,8 @@ class Kw {
67231
67232
  onUpdate: () => {
67232
67233
  this.__SettingsUpdate();
67233
67234
  }
67234
- })), this.__RegisterVideoEventListener("webkitplaybacktargetavailabilitychanged", (M) => {
67235
- this.airplayAvailable = M.availability === "available", this.__SettingsUpdate();
67235
+ })), this.__RegisterVideoEventListener("webkitplaybacktargetavailabilitychanged", (R) => {
67236
+ this.airplayAvailable = R.availability === "available", this.__SettingsUpdate();
67236
67237
  });
67237
67238
  const a = this.__RegisterVideoEventListener("timeupdate", () => {
67238
67239
  this.reloads = 0, this.playbackStarted = !0, this.__SettingsUpdate(), a();
@@ -67242,8 +67243,8 @@ class Kw {
67242
67243
  }), this.__RegisterVideoEventListener("seeking", () => {
67243
67244
  if (!this.isLive || !this.dvrAvailable)
67244
67245
  return;
67245
- const M = this.video.duration - this.video.currentTime;
67246
- this.behindLiveEdge = M > 15, this.__SettingsUpdate();
67246
+ const R = this.video.duration - this.video.currentTime;
67247
+ this.behindLiveEdge = R > 15, this.__SettingsUpdate();
67247
67248
  }), await this.__LoadCollection(), this.collectionInfo && this.collectionInfo.isPlaylist && this.collectionInfo.mediaIndex < this.collectionInfo.mediaLength - 1 && this.__RegisterVideoEventListener("ended", () => this.controls && this.controls.CollectionPlayNext({ autoplay: !0 }));
67248
67249
  let {
67249
67250
  objectId: s,
@@ -67256,42 +67257,44 @@ class Kw {
67256
67257
  multiviewOptions: m,
67257
67258
  playoutParameters: v,
67258
67259
  trimOffset: b,
67259
- offering: x,
67260
- compositionKey: E,
67261
- clipStart: C,
67262
- clipEnd: T
67260
+ thumbnailOffset: x,
67261
+ offering: E,
67262
+ compositionKey: C,
67263
+ clipStart: T,
67264
+ clipEnd: k
67263
67265
  } = await this.__PlayoutOptions();
67264
67266
  this.playoutInfo = {
67265
67267
  objectId: s,
67266
67268
  versionHash: u,
67267
- offering: x,
67268
- compositionKey: E,
67269
+ offering: E,
67270
+ compositionKey: C,
67269
67271
  trimOffset: b,
67270
- clipStart: C,
67271
- clipEnd: T
67272
+ thumbnailOffset: x,
67273
+ clipStart: T,
67274
+ clipEnd: k
67272
67275
  }, this.contentHash = u, o = new URL(o);
67273
- const k = this.sourceOptions.playoutParameters.authorizationToken || o.searchParams.get("authorization");
67274
- if (this.authorizationToken = k, this.playoutUrl = o.toString(), this.thumbnailTrackUrl = c, this.castHandler && this.castHandler.SetMedia({
67276
+ const M = this.sourceOptions.playoutParameters.authorizationToken || o.searchParams.get("authorization");
67277
+ if (this.authorizationToken = M, this.playoutUrl = o.toString(), this.thumbnailTrackUrl = c, this.castHandler && this.castHandler.SetMedia({
67275
67278
  playoutOptions: this.sourceOptions.playoutOptions,
67276
67279
  playoutParameters: v
67277
67280
  }), this.__destroyed)
67278
67281
  return;
67279
- p === "hls" ? await this.__InitializeHLS({ playoutUrl: o, authorizationToken: k, drm: d, drms: y, multiviewOptions: m }) : await this.__InitializeDash({ playoutUrl: o, authorizationToken: k, drm: d, drms: y, multiviewOptions: m }), this.playerOptions.collectVideoAnalytics && import("./Analytics-Cia_WeMD.mjs").then(({ InitializeMuxMonitoring: M }) => M({
67282
+ p === "hls" ? await this.__InitializeHLS({ playoutUrl: o, authorizationToken: M, drm: d, drms: y, multiviewOptions: m }) : await this.__InitializeDash({ playoutUrl: o, authorizationToken: M, drm: d, drms: y, multiviewOptions: m }), this.playerOptions.collectVideoAnalytics && import("./Analytics-PhARu_hv.mjs").then(({ InitializeMuxMonitoring: R }) => R({
67280
67283
  appName: this.playerOptions.appName || "elv-player-js",
67281
67284
  elvPlayer: this,
67282
67285
  playoutUrl: o,
67283
- authorizationToken: k,
67286
+ authorizationToken: M,
67284
67287
  disableCookies: this.playerOptions.collectVideoAnalytics === $t.collectVideoAnalytics.DISABLE_COOKIES
67285
67288
  })), this.playerOptions.verifyContent && setTimeout(() => {
67286
67289
  this.__VerifyContent();
67287
- }, 1e3), this.playerOptions.loadChapters && this.__LoadChapters({ ...this.playoutInfo || {} }).then((M) => this.__chapterTags = M).catch((M) => this.Log(M, !0)), this.playerOptions.playerCallback && this.playerOptions.playerCallback({
67290
+ }, 1e3), this.playerOptions.loadChapters && this.__LoadChapters({ ...this.playoutInfo || {} }).then((R) => this.__chapterTags = R).catch((R) => this.Log(R, !0)), this.playerOptions.playerCallback && this.playerOptions.playerCallback({
67288
67291
  player: this,
67289
67292
  videoElement: this.video,
67290
67293
  hlsPlayer: this.hlsPlayer,
67291
67294
  dashPlayer: this.dashPlayer
67292
67295
  }), this.__destroyed && this.__DestroyPlayer(), this.initialized = !0, this.restartParameters = void 0, this.thumbnailTrackUrl && (this.thumbnailHandler = new Cee(
67293
67296
  this.thumbnailTrackUrl,
67294
- b || 0
67297
+ x || b || 0
67295
67298
  ), this.thumbnailHandler.LoadThumbnails().then(() => {
67296
67299
  this.thumbnailsLoaded = !0, this.__SettingsUpdate();
67297
67300
  }));
@@ -67426,8 +67429,8 @@ class Kw {
67426
67429
  }
67427
67430
  }
67428
67431
  async __InitializeDash({ playoutUrl: e, authorizationToken: t, drm: a, drms: s }) {
67429
- this.Dash = (await import("./dash.all.min-CyrHsR08.mjs").then((c) => c.d)).default;
67430
- const u = this.Dash.MediaPlayer().create(), o = this.playerOptions.dashjsOptions || {};
67432
+ this.Dash = (await import("./dash.all.min-yDykE22p.mjs")).MediaPlayer;
67433
+ const u = this.Dash().create(), o = this.playerOptions.dashjsOptions || {};
67431
67434
  if (u.updateSettings({
67432
67435
  ...o,
67433
67436
  streaming: {
@@ -67454,11 +67457,8 @@ class Kw {
67454
67457
  maxBitrate: { video: this.playerOptions.maxBitrate / 1e3 }
67455
67458
  }
67456
67459
  }
67457
- }), e.searchParams.delete("authorization"), u.extend("RequestModifier", function() {
67458
- return {
67459
- modifyRequestHeader: (c) => (c.setRequestHeader("Authorization", `Bearer ${t}`), c),
67460
- modifyRequestURL: (c) => c
67461
- };
67460
+ }), e.searchParams.delete("authorization"), u.addRequestInterceptor(function(c) {
67461
+ return c.headers.Authorization = `Bearer ${t}`, c;
67462
67462
  }), a === $t.drms.WIDEVINE) {
67463
67463
  const c = s.widevine.licenseServers[0];
67464
67464
  u.setProtectionData({
@@ -67472,15 +67472,15 @@ class Kw {
67472
67472
  e.toString(),
67473
67473
  this.playerOptions.autoplay === $t.autoplay.ON
67474
67474
  ), [
67475
- this.Dash.MediaPlayer.events.TRACK_CHANGE_RENDERED,
67476
- this.Dash.MediaPlayer.events.QUALITY_CHANGE_RENDERED,
67477
- this.Dash.MediaPlayer.events.REPRESENTATION_SWITCH,
67478
- this.Dash.MediaPlayer.events.TEXT_TRACKS_ADDED,
67479
- this.Dash.MediaPlayer.events.TEXT_TRACK_ADDED,
67480
- this.Dash.MediaPlayer.events.MANIFEST_LOADED,
67481
- this.Dash.MediaPlayer.events.CAN_PLAY
67475
+ this.Dash.events.TRACK_CHANGE_RENDERED,
67476
+ this.Dash.events.QUALITY_CHANGE_RENDERED,
67477
+ this.Dash.events.REPRESENTATION_SWITCH,
67478
+ this.Dash.events.TEXT_TRACKS_ADDED,
67479
+ this.Dash.events.TEXT_TRACK_ADDED,
67480
+ this.Dash.events.MANIFEST_LOADED,
67481
+ this.Dash.events.CAN_PLAY
67482
67482
  ].map((c) => u.on(c, () => this.__SettingsUpdate())), typeof this.sourceOptions.playoutParameters.audioTrackLabel < "u" && u.on(
67483
- this.Dash.MediaPlayer.events.CAN_PLAY,
67483
+ this.Dash.events.CAN_PLAY,
67484
67484
  () => {
67485
67485
  const c = (this.controls.GetAudioTracks().options || []).find((p) => p.label === this.sourceOptions.playoutParameters.audioTrackLabel);
67486
67486
  c && this.controls.SetAudioTrack(c.index);
@@ -69152,7 +69152,7 @@ const pD = ({ player: r, videoState: e, setRecentUserAction: t, className: a = "
69152
69152
  onClick: () => {
69153
69153
  r.controls.Play(), r.target.firstChild.focus();
69154
69154
  },
69155
- className: `${Bn["center-play-button"]} ${t && !e && !(r && r.casting) ? "" : Bn["center-play-button--hidden"]}`
69155
+ className: `${Bn["center-play-button"]} ${t && !e && !(r && r.casting) && !(r && r.controls && r.controls.IsPlaying() && !r.casting) ? "" : Bn["center-play-button--hidden"]}`
69156
69156
  }
69157
69157
  ),
69158
69158
  /* @__PURE__ */ Ue.jsxs("div", { className: `${Bn["bottom-controls-container"]} ${x ? Bn["bottom-controls-container--autohide"] : ""}`, children: [
@@ -69775,7 +69775,7 @@ const hne = ({
69775
69775
  window.__elvPlayer = Oe;
69776
69776
  const Se = Oe.controls.RegisterSettingsListener(
69777
69777
  () => {
69778
- $(Oe.controls.AllowRotation()), se(Oe.playbackStarted), R(!Oe.loading), _(Oe.__showPlayerProfileForm), N(Oe && Oe.casting);
69778
+ $(Oe.controls.AllowRotation()), se(Oe.playbackStarted || Oe.controls && Oe.controls.IsPlaying()), R(!Oe.loading), _(Oe.__showPlayerProfileForm), N(Oe && Oe.casting);
69779
69779
  }
69780
69780
  );
69781
69781
  Oe.Destroy = () => {
@@ -1,4 +1,4 @@
1
- import { c as DI, r as tI, a as TA, b as rI, d as oA, e as uA, f as PA, g as cI } from "./index-znYnmQZ9.mjs";
1
+ import { c as DI, r as tI, a as TA, b as rI, d as oA, e as uA, f as PA, g as cI } from "./index-BrEf07aq.mjs";
2
2
  class BA {
3
3
  constructor(B) {
4
4
  this.wasm = B;