@eluvio/elv-player-js 2.0.47 → 2.0.49

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.
@@ -1,4 +1,4 @@
1
- import { c as cI, e as CI, r as vA, a as eI, b as fA, i as dA, s as xA, g as wI } from "./index-T6omfWL1.mjs";
1
+ import { c as cI, e as CI, r as vA, a as eI, b as fA, i as dA, s as xA, g as wI } from "./index-DeV-6N-Y.mjs";
2
2
  class EA {
3
3
  constructor(I) {
4
4
  this.wasm = I;
@@ -49714,7 +49714,7 @@ const ii = {
49714
49714
  ElvCrypto: async () => {
49715
49715
  try {
49716
49716
  if (!ii.elvCrypto) {
49717
- const n = (await import("./index-DZXXA08p.mjs")).default;
49717
+ const n = (await import("./index-D2DLsakf.mjs")).default;
49718
49718
  ii.elvCrypto = await new n().init();
49719
49719
  }
49720
49720
  return ii.elvCrypto;
@@ -66125,11 +66125,25 @@ class o2 {
66125
66125
  drms: i,
66126
66126
  multiviewOptions: o
66127
66127
  }), g ? this.video.play() : this.video.pause(), this.isLive || (this.video.currentTime = S);
66128
- }, m.on(
66129
- this.HLS.Events.FRAG_LOADED,
66130
- () => this.errors = 0
66131
- ), m.on(this.HLS.Events.ERROR, async (w, b) => {
66132
- 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"), m.recoverMediaError()) : this.__HardReload(b)) : this.__HardReload(b);
66128
+ }, m.on(this.HLS.Events.FRAG_LOADED, () => {
66129
+ this.errors = 0, clearTimeout(this.stallTimeout);
66130
+ }), m.on(this.HLS.Events.ERROR, async (w, b) => {
66131
+ if (this.errors += 1, this.Log(`Encountered ${b.details}`, !0), this.Log(b, !0), b.response && b.response.code === 403)
66132
+ this.SetErrorMessage("Insufficient permissions", b);
66133
+ else if (this.errors < 5) {
66134
+ if (b.fatal)
66135
+ b.data && b.data.type === this.HLS.ErrorTypes.MEDIA_ERROR ? (this.Log("Attempting to recover using hlsPlayer.recoverMediaError", !0), m.recoverMediaError()) : this.__HardReload(b);
66136
+ else if (b.details === "bufferStalledError") {
66137
+ clearTimeout(this.stallTimeout);
66138
+ let g = this.video && this.video.currentTime;
66139
+ setTimeout(() => {
66140
+ this.video && this.video.currentTime > g || (this.Log("Buffer Stalled. Attempting to recover using hlsPlayer.recoverMediaError", !0), m.recoverMediaError(), this.stallTimeout = setTimeout(() => {
66141
+ this.Log("Buffer Stalled. Reloading player...", !0), this.__HardReload(b, 0);
66142
+ }, 5e3));
66143
+ }, 2e3);
66144
+ }
66145
+ } else
66146
+ this.__HardReload(b);
66133
66147
  }), this.hlsPlayer = m, this.player = m, l) {
66134
66148
  const w = document.createElement("source");
66135
66149
  w.src = this.playoutUrl.toString(), this.video.appendChild(w), this.video.disableRemotePlayback = !1;
@@ -66137,7 +66151,7 @@ class o2 {
66137
66151
  }
66138
66152
  }
66139
66153
  async __InitializeDash({ playoutUrl: e, authorizationToken: t, drm: r, drms: i }) {
66140
- this.Dash = (await import("./dash.all.min-CT5cJjLJ.mjs").then((c) => c.d)).default;
66154
+ this.Dash = (await import("./dash.all.min-BeiZatYH.mjs").then((c) => c.d)).default;
66141
66155
  const o = this.Dash.MediaPlayer().create(), l = this.playerOptions.dashjsOptions || {};
66142
66156
  if (o.updateSettings({
66143
66157
  ...l,
@@ -776,9 +776,10 @@ export class EluvioPlayer {
776
776
  };
777
777
 
778
778
  // Error handling
779
- hlsPlayer.on(this.HLS.Events.FRAG_LOADED, () =>
780
- this.errors = 0
781
- );
779
+ hlsPlayer.on(this.HLS.Events.FRAG_LOADED, () => {
780
+ this.errors = 0;
781
+ clearTimeout(this.stallTimeout);
782
+ });
782
783
 
783
784
  hlsPlayer.on(this.HLS.Events.ERROR, async (event, error) => {
784
785
  this.errors += 1;
@@ -792,11 +793,28 @@ export class EluvioPlayer {
792
793
  } else if(this.errors < 5) {
793
794
  if(error.fatal) {
794
795
  if(error.data && error.data.type === this.HLS.ErrorTypes.MEDIA_ERROR) {
795
- this.Log("Attempting to recover using hlsPlayer.recoverMediaError");
796
+ this.Log("Attempting to recover using hlsPlayer.recoverMediaError", true);
796
797
  hlsPlayer.recoverMediaError();
797
798
  } else {
798
799
  this.__HardReload(error);
799
800
  }
801
+ } else if(error.details === "bufferStalledError") {
802
+ clearTimeout(this.stallTimeout);
803
+
804
+ let stalledTime = this.video && this.video.currentTime;
805
+ setTimeout(() => {
806
+ if(this.video && this.video.currentTime > stalledTime) {
807
+ return;
808
+ }
809
+
810
+ this.Log("Buffer Stalled. Attempting to recover using hlsPlayer.recoverMediaError", true);
811
+ hlsPlayer.recoverMediaError();
812
+
813
+ this.stallTimeout = setTimeout(() => {
814
+ this.Log("Buffer Stalled. Reloading player...", true);
815
+ this.__HardReload(error, 0);
816
+ }, 5000);
817
+ }, 2000);
800
818
  }
801
819
  } else {
802
820
  this.__HardReload(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-player-js",
3
- "version": "2.0.47",
3
+ "version": "2.0.49",
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",