@eluvio/elv-player-js 2.0.48 → 2.0.50

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.
@@ -158,7 +158,8 @@ const Ft = {
158
158
  authorizationToken: void 0,
159
159
  clipStart: void 0,
160
160
  clipEnd: void 0,
161
- audioTrackLabel: void 0
161
+ audioTrackLabel: void 0,
162
+ options: void 0
162
163
  }
163
164
  },
164
165
  playerOptions: {
@@ -49714,7 +49715,7 @@ const ii = {
49714
49715
  ElvCrypto: async () => {
49715
49716
  try {
49716
49717
  if (!ii.elvCrypto) {
49717
- const n = (await import("./index-CdPL6p_Q.mjs")).default;
49718
+ const n = (await import("./index-CiWJ7kFm.mjs")).default;
49718
49719
  ii.elvCrypto = await new n().init();
49719
49720
  }
49720
49721
  return ii.elvCrypto;
@@ -65870,7 +65871,8 @@ class o2 {
65870
65871
  }
65871
65872
  let r, i, o = {
65872
65873
  ignore_trimming: t.ignoreTrimming,
65873
- resolve: t.resolve
65874
+ resolve: t.resolve,
65875
+ ...t.options || {}
65874
65876
  };
65875
65877
  if ((t.clipStart || t.clipEnd) && (o.clip_start = parseFloat(t.clipStart || 0), t.clipEnd && (o.clip_end = parseFloat(t.clipEnd))), !t.channel) {
65876
65878
  let g = await e.AvailableOfferings({
@@ -66128,11 +66130,22 @@ class o2 {
66128
66130
  }, m.on(this.HLS.Events.FRAG_LOADED, () => {
66129
66131
  this.errors = 0, clearTimeout(this.stallTimeout);
66130
66132
  }), m.on(this.HLS.Events.ERROR, async (w, b) => {
66131
- this.errors += 1, this.Log(`Encountered ${b.details}`, !0), this.Log(b, !0), b.response && b.response.code === 403 ? this.SetErrorMessage("Insufficient permissions", b) : this.errors < 5 ? b.fatal ? b.data && b.data.type === this.HLS.ErrorTypes.MEDIA_ERROR ? (this.Log("Attempting to recover using hlsPlayer.recoverMediaError", !0), m.recoverMediaError()) : this.__HardReload(b) : b.details === "bufferStalledError" && (clearTimeout(this.stallTimeout), this.stallTimeout = setTimeout(() => {
66132
- this.Log("Buffer Stalled. Attempting to recover using hlsPlayer.recoverMediaError", !0), m.recoverMediaError(), this.stallTimeout = setTimeout(() => {
66133
- this.Log("Buffer Stalled. Reloading player...", !0), this.__HardReload(b, 0);
66134
- }, 5e3);
66135
- }, 2e3)) : this.__HardReload(b);
66133
+ if (this.errors += 1, this.Log(`Encountered ${b.details}`, !0), this.Log(b, !0), b.response && b.response.code === 403)
66134
+ this.SetErrorMessage("Insufficient permissions", b);
66135
+ else if (this.errors < 5) {
66136
+ if (b.fatal)
66137
+ b.data && b.data.type === this.HLS.ErrorTypes.MEDIA_ERROR ? (this.Log("Attempting to recover using hlsPlayer.recoverMediaError", !0), m.recoverMediaError()) : this.__HardReload(b);
66138
+ else if (b.details === "bufferStalledError") {
66139
+ clearTimeout(this.stallTimeout);
66140
+ let g = this.video && this.video.currentTime;
66141
+ setTimeout(() => {
66142
+ this.video && this.video.currentTime > g || (this.Log("Buffer Stalled. Attempting to recover using hlsPlayer.recoverMediaError", !0), m.recoverMediaError(), this.stallTimeout = setTimeout(() => {
66143
+ this.Log("Buffer Stalled. Reloading player...", !0), this.__HardReload(b, 0, g);
66144
+ }, 5e3));
66145
+ }, 2e3);
66146
+ }
66147
+ } else
66148
+ this.__HardReload(b);
66136
66149
  }), this.hlsPlayer = m, this.player = m, l) {
66137
66150
  const w = document.createElement("source");
66138
66151
  w.src = this.playoutUrl.toString(), this.video.appendChild(w), this.video.disableRemotePlayback = !1;
@@ -66140,7 +66153,7 @@ class o2 {
66140
66153
  }
66141
66154
  }
66142
66155
  async __InitializeDash({ playoutUrl: e, authorizationToken: t, drm: r, drms: i }) {
66143
- this.Dash = (await import("./dash.all.min-QGl1wpEL.mjs").then((c) => c.d)).default;
66156
+ this.Dash = (await import("./dash.all.min-BYIiRwuH.mjs").then((c) => c.d)).default;
66144
66157
  const o = this.Dash.MediaPlayer().create(), l = this.playerOptions.dashjsOptions || {};
66145
66158
  if (o.updateSettings({
66146
66159
  ...l,
@@ -66349,7 +66362,7 @@ class o2 {
66349
66362
  this.contentHash = void 0, this.nativeHLS = !1, this.hlsPlayer = void 0, this.dashPlayer = void 0, this.player = void 0, this.initTimeLogged = !1, this.canPlay = !1, this.isLive = !1, this.behindLiveEdge = !1, this.dvrAvailable = !1, this.dvrEnabled = !1, this.publicMetadataUrl = void 0, this.airplayAvailable = !1, this.chromecastAvailable = VP && this.playerOptions.allowCasting, this.casting = !1, this.__error = void 0;
66350
66363
  }
66351
66364
  }
66352
- async __HardReload(e, t = 6e3) {
66365
+ async __HardReload(e, t = 6e3, r) {
66353
66366
  if (!this.reloading) {
66354
66367
  if (this.reloading = !0, this.reloads += 1, this.reloads > 10) {
66355
66368
  this.SetErrorMessage(e && e.displayMessage || "Unable to play content", e);
@@ -66359,32 +66372,32 @@ class o2 {
66359
66372
  try {
66360
66373
  if (e && this.playerOptions.restartCallback)
66361
66374
  try {
66362
- const r = await this.playerOptions.restartCallback(e);
66363
- if (r && typeof r == "boolean") {
66375
+ const i = await this.playerOptions.restartCallback(e);
66376
+ if (i && typeof i == "boolean") {
66364
66377
  this.Destroy();
66365
66378
  return;
66366
66379
  }
66367
- } catch (r) {
66368
- this.Log("Restart callback failed:"), this.Log(r);
66380
+ } catch (i) {
66381
+ this.Log("Restart callback failed:"), this.Log(i);
66369
66382
  }
66370
- if (this.SetErrorMessage(
66383
+ if (t > 0 && (this.SetErrorMessage(
66371
66384
  e && e.displayMessage || "Something went wrong, reloading player...",
66372
66385
  e
66373
- ), await new Promise((r) => setTimeout(r, t)), this.__destroyed)
66386
+ ), await new Promise((i) => setTimeout(i, t))), this.__destroyed)
66374
66387
  return;
66375
66388
  this.Log("Reloading stream");
66376
66389
  try {
66377
- const r = await this.__Client();
66378
- r.region ? await r.UseRegion({ region: r.region }) : r.Nodes().fabricURIs.length > 1 && await r.ResetRegion();
66379
- } catch (r) {
66380
- this.Log("Client region reset failed:"), this.Log(r);
66390
+ const i = await this.__Client();
66391
+ i.region ? await i.UseRegion({ region: i.region }) : i.Nodes().fabricURIs.length > 1 && await i.ResetRegion();
66392
+ } catch (i) {
66393
+ this.Log("Client region reset failed:"), this.Log(i);
66381
66394
  }
66382
66395
  this.restarted = !0, this.SetErrorMessage(void 0), this.__Initialize(
66383
66396
  this.originalParameters,
66384
66397
  !this.video || !this.initialized ? this.restartParameters : {
66385
66398
  muted: this.video.muted,
66386
66399
  volume: this.video.volume,
66387
- currentTime: this.video.currentTime,
66400
+ currentTime: r || this.video.currentTime,
66388
66401
  playing: !this.video.paused
66389
66402
  }
66390
66403
  );
@@ -151,7 +151,8 @@ export class EluvioPlayer {
151
151
  let offeringId, offeringURI;
152
152
  let options = {
153
153
  ignore_trimming: playoutParameters.ignoreTrimming,
154
- resolve: playoutParameters.resolve
154
+ resolve: playoutParameters.resolve,
155
+ ...(playoutParameters.options || {})
155
156
  };
156
157
 
157
158
  if(playoutParameters.clipStart || playoutParameters.clipEnd) {
@@ -801,13 +802,18 @@ export class EluvioPlayer {
801
802
  } else if(error.details === "bufferStalledError") {
802
803
  clearTimeout(this.stallTimeout);
803
804
 
804
- this.stallTimeout = setTimeout(() => {
805
+ let stalledTime = this.video && this.video.currentTime;
806
+ setTimeout(() => {
807
+ if(this.video && this.video.currentTime > stalledTime) {
808
+ return;
809
+ }
810
+
805
811
  this.Log("Buffer Stalled. Attempting to recover using hlsPlayer.recoverMediaError", true);
806
812
  hlsPlayer.recoverMediaError();
807
813
 
808
814
  this.stallTimeout = setTimeout(() => {
809
815
  this.Log("Buffer Stalled. Reloading player...", true);
810
- this.__HardReload(error, 0);
816
+ this.__HardReload(error, 0, stalledTime);
811
817
  }, 5000);
812
818
  }, 2000);
813
819
  }
@@ -1216,7 +1222,7 @@ export class EluvioPlayer {
1216
1222
  this.__error = undefined;
1217
1223
  }
1218
1224
 
1219
- async __HardReload(error, delay=6000) {
1225
+ async __HardReload(error, delay=6000, time) {
1220
1226
  if(this.reloading) { return; }
1221
1227
 
1222
1228
  this.reloading = true;
@@ -1247,11 +1253,13 @@ export class EluvioPlayer {
1247
1253
  }
1248
1254
  }
1249
1255
 
1250
- this.SetErrorMessage(
1251
- (error && error.displayMessage) || "Something went wrong, reloading player...",
1252
- error
1253
- );
1254
- await new Promise(resolve => setTimeout(resolve, delay));
1256
+ if(delay > 0) {
1257
+ this.SetErrorMessage(
1258
+ (error && error.displayMessage) || "Something went wrong, reloading player...",
1259
+ error
1260
+ );
1261
+ await new Promise(resolve => setTimeout(resolve, delay));
1262
+ }
1255
1263
 
1256
1264
  if(this.__destroyed) { return; }
1257
1265
 
@@ -1278,7 +1286,7 @@ export class EluvioPlayer {
1278
1286
  {
1279
1287
  muted: this.video.muted,
1280
1288
  volume: this.video.volume,
1281
- currentTime: this.video.currentTime,
1289
+ currentTime: time || this.video.currentTime,
1282
1290
  playing: !this.video.paused
1283
1291
  }
1284
1292
  );
@@ -160,7 +160,8 @@ export const DefaultParameters = {
160
160
  authorizationToken: undefined,
161
161
  clipStart: undefined,
162
162
  clipEnd: undefined,
163
- audioTrackLabel: undefined
163
+ audioTrackLabel: undefined,
164
+ options: undefined
164
165
  }
165
166
  },
166
167
  playerOptions: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-player-js",
3
- "version": "2.0.48",
3
+ "version": "2.0.50",
4
4
  "description": "![Eluvio Logo](lib/static/images/Logo.png \"Eluvio Logo\")",
5
5
  "main": "dist/elv-player-js.es.js",
6
6
  "license": "MIT",