@shortkitsdk/web 0.3.2 → 0.3.3

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/dist/shortkit.mjs CHANGED
@@ -33542,35 +33542,16 @@ class PlayerPool {
33542
33542
  player._skCurrentUrl = streamingUrl;
33543
33543
  }
33544
33544
  /**
33545
- * Promote a preload player to active: raise buffer limits, uncap ABR, and
33546
- * force an immediate quality upgrade.
33547
- *
33548
- * Preload streams start at level 0 (lowest rendition) to conserve bandwidth.
33549
- * When attachStream() is called again with isActive=true for the same URL it
33550
- * early-returns, so the HLS instance keeps its startLevel:0 config. The
33551
- * already-buffered low-quality segments play through before any higher-quality
33552
- * segments arrive — causing a visible low-res start even on fast connections.
33553
- *
33554
- * Fix: lock HLS to the highest level, then seek-in-place to flush the
33555
- * low-quality buffer so the player immediately re-fetches at high quality.
33556
- * Re-enable ABR after a few seconds so slow connections self-correct.
33545
+ * Promote a preload player to active: raise buffer limits and uncap ABR.
33546
+ * Safe to call even if the HLS instance was already created with active config.
33557
33547
  */
33558
33548
  promoteToActive(itemId) {
33559
33549
  const hls = this.hlsInstances.get(itemId);
33560
- if (!hls) return;
33561
- hls.config.maxBufferLength = PlayerPool.ACTIVE_HLS_CONFIG.maxBufferLength;
33562
- hls.config.maxMaxBufferLength = PlayerPool.ACTIVE_HLS_CONFIG.maxMaxBufferLength;
33563
- hls.autoLevelCapping = -1;
33564
- const top = hls.levels ? hls.levels.length - 1 : -1;
33565
- if (top > 0 && hls.currentLevel < top) {
33566
- hls.currentLevel = top;
33567
- const player = this.assignments.get(itemId);
33568
- if (player) {
33569
- player.currentTime = player.currentTime;
33570
- }
33571
- setTimeout(() => {
33572
- if (!hls.destroyed) hls.currentLevel = -1;
33573
- }, 4e3);
33550
+ if (hls) {
33551
+ hls.config.maxBufferLength = PlayerPool.ACTIVE_HLS_CONFIG.maxBufferLength;
33552
+ hls.config.maxMaxBufferLength = PlayerPool.ACTIVE_HLS_CONFIG.maxMaxBufferLength;
33553
+ hls.autoLevelCapping = -1;
33554
+ hls.nextAutoLevel = -1;
33574
33555
  }
33575
33556
  }
33576
33557
  /** Pause, destroy HLS, and remove player from DOM and pool tracking. */
@@ -34603,7 +34584,6 @@ class EmbeddedFeedManager {
34603
34584
  this._setupScrollEnd();
34604
34585
  this._setupVisibilityHandler();
34605
34586
  this._setupCellHeightObserver();
34606
- this._setupDebugPanel();
34607
34587
  if (startIndex > 0 && startIndex < items.length) {
34608
34588
  const targetEl = this.itemEls.get(items[startIndex].id);
34609
34589
  if (targetEl) targetEl.scrollIntoView({ behavior: "instant", block: "start" });
@@ -34626,11 +34606,6 @@ class EmbeddedFeedManager {
34626
34606
  this._resizeObserver = null;
34627
34607
  }
34628
34608
  if (this._visHandler) document.removeEventListener("visibilitychange", this._visHandler);
34629
- if (this._debugKeyHandler) document.removeEventListener("keydown", this._debugKeyHandler);
34630
- if (this._debugPanel) {
34631
- this._debugPanel.remove();
34632
- this._debugPanel = null;
34633
- }
34634
34609
  this.container.innerHTML = "";
34635
34610
  this.itemEls.clear();
34636
34611
  this.items = [];
@@ -34964,55 +34939,12 @@ class EmbeddedFeedManager {
34964
34939
  this._stopTimeLoop(id);
34965
34940
  this._detachOverlay(id);
34966
34941
  }
34967
- // --- Debug panel (toggle with 'D' key) ---
34968
- _setupDebugPanel() {
34969
- const panel = document.createElement("div");
34970
- panel.id = "sk-debug-panel";
34971
- panel.style.cssText = "position:fixed;top:12px;right:12px;z-index:99999;background:rgba(0,0,0,.85);color:#0f0;font:12px/1.5 monospace;padding:10px 14px;border-radius:8px;pointer-events:none;display:none;min-width:220px;";
34972
- document.body.appendChild(panel);
34973
- this._debugPanel = panel;
34974
- this._debugVisible = false;
34975
- this._debugKeyHandler = (e) => {
34976
- if (e.key === "d" || e.key === "D") {
34977
- this._debugVisible = !this._debugVisible;
34978
- panel.style.display = this._debugVisible ? "block" : "none";
34979
- }
34980
- };
34981
- document.addEventListener("keydown", this._debugKeyHandler);
34982
- }
34983
- _updateDebugPanel() {
34984
- if (!this._debugVisible || !this._debugPanel) return;
34985
- const hls = this.pool.hlsInstances.get(this.activeItemId);
34986
- if (!hls || !hls.levels || !hls.levels.length) {
34987
- this._debugPanel.innerHTML = "HLS: no levels loaded";
34988
- return;
34989
- }
34990
- const level = hls.levels[hls.currentLevel] || {};
34991
- const bw = hls.bandwidthEstimate ? (hls.bandwidthEstimate / 1e6).toFixed(2) : "?";
34992
- const lines = [
34993
- `<b style="color:#fff">HLS Debug</b>`,
34994
- `Level: ${hls.currentLevel} / ${hls.levels.length - 1}`,
34995
- `Resolution: ${level.width || "?"}x${level.height || "?"}`,
34996
- `Bitrate: ${level.bitrate ? (level.bitrate / 1e3).toFixed(0) + " kbps" : "?"}`,
34997
- `BW estimate: ${bw} Mbps`,
34998
- `Auto cap: ${hls.autoLevelCapping}`,
34999
- `Next level: ${hls.nextLevel}`,
35000
- `<span style="color:#888">Levels:</span>`
35001
- ];
35002
- for (let i = 0; i < hls.levels.length; i++) {
35003
- const l = hls.levels[i];
35004
- const marker = i === hls.currentLevel ? ' <b style="color:#0ff">◀</b>' : "";
35005
- lines.push(` ${i}: ${l.width}x${l.height} @ ${(l.bitrate / 1e3).toFixed(0)}k${marker}`);
35006
- }
35007
- this._debugPanel.innerHTML = lines.join("<br>");
35008
- }
35009
34942
  // --- Time loop (state emission only, no DOM updates) ---
35010
34943
  _startTimeLoop(id, el, player) {
35011
34944
  this._stopTimeLoop(id);
35012
34945
  const tick = () => {
35013
34946
  if (this._destroyed) return;
35014
34947
  if (!player || player.paused) {
35015
- this._updateDebugPanel();
35016
34948
  this.rafIds.set(id, requestAnimationFrame(tick));
35017
34949
  return;
35018
34950
  }
@@ -35038,7 +34970,6 @@ class EmbeddedFeedManager {
35038
34970
  player.play().catch(() => {
35039
34971
  });
35040
34972
  }
35041
- this._updateDebugPanel();
35042
34973
  this.rafIds.set(id, requestAnimationFrame(tick));
35043
34974
  };
35044
34975
  this.rafIds.set(id, requestAnimationFrame(tick));
@@ -36104,20 +36035,11 @@ class WidgetPlayerPool {
36104
36035
  }
36105
36036
  promoteToActive(itemId) {
36106
36037
  const hls = this.hlsInstances.get(itemId);
36107
- if (!hls) return;
36108
- hls.config.maxBufferLength = WidgetPlayerPool.ACTIVE_HLS_CONFIG.maxBufferLength;
36109
- hls.config.maxMaxBufferLength = WidgetPlayerPool.ACTIVE_HLS_CONFIG.maxMaxBufferLength;
36110
- hls.autoLevelCapping = -1;
36111
- const top = hls.levels ? hls.levels.length - 1 : -1;
36112
- if (top > 0 && hls.currentLevel < top) {
36113
- hls.currentLevel = top;
36114
- const player = this.assignments.get(itemId);
36115
- if (player) {
36116
- player.currentTime = player.currentTime;
36117
- }
36118
- setTimeout(() => {
36119
- if (!hls.destroyed) hls.currentLevel = -1;
36120
- }, 4e3);
36038
+ if (hls) {
36039
+ hls.config.maxBufferLength = WidgetPlayerPool.ACTIVE_HLS_CONFIG.maxBufferLength;
36040
+ hls.config.maxMaxBufferLength = WidgetPlayerPool.ACTIVE_HLS_CONFIG.maxMaxBufferLength;
36041
+ hls.autoLevelCapping = -1;
36042
+ hls.nextAutoLevel = -1;
36121
36043
  }
36122
36044
  }
36123
36045
  _destroyHls(itemId) {
@@ -601,35 +601,16 @@ class PlayerPool {
601
601
  player._skCurrentUrl = streamingUrl;
602
602
  }
603
603
  /**
604
- * Promote a preload player to active: raise buffer limits, uncap ABR, and
605
- * force an immediate quality upgrade.
606
- *
607
- * Preload streams start at level 0 (lowest rendition) to conserve bandwidth.
608
- * When attachStream() is called again with isActive=true for the same URL it
609
- * early-returns, so the HLS instance keeps its startLevel:0 config. The
610
- * already-buffered low-quality segments play through before any higher-quality
611
- * segments arrive — causing a visible low-res start even on fast connections.
612
- *
613
- * Fix: lock HLS to the highest level, then seek-in-place to flush the
614
- * low-quality buffer so the player immediately re-fetches at high quality.
615
- * Re-enable ABR after a few seconds so slow connections self-correct.
604
+ * Promote a preload player to active: raise buffer limits and uncap ABR.
605
+ * Safe to call even if the HLS instance was already created with active config.
616
606
  */
617
607
  promoteToActive(itemId) {
618
608
  const hls = this.hlsInstances.get(itemId);
619
- if (!hls) return;
620
- hls.config.maxBufferLength = PlayerPool.ACTIVE_HLS_CONFIG.maxBufferLength;
621
- hls.config.maxMaxBufferLength = PlayerPool.ACTIVE_HLS_CONFIG.maxMaxBufferLength;
622
- hls.autoLevelCapping = -1;
623
- const top = hls.levels ? hls.levels.length - 1 : -1;
624
- if (top > 0 && hls.currentLevel < top) {
625
- hls.currentLevel = top;
626
- const player = this.assignments.get(itemId);
627
- if (player) {
628
- player.currentTime = player.currentTime;
629
- }
630
- setTimeout(() => {
631
- if (!hls.destroyed) hls.currentLevel = -1;
632
- }, 4e3);
609
+ if (hls) {
610
+ hls.config.maxBufferLength = PlayerPool.ACTIVE_HLS_CONFIG.maxBufferLength;
611
+ hls.config.maxMaxBufferLength = PlayerPool.ACTIVE_HLS_CONFIG.maxMaxBufferLength;
612
+ hls.autoLevelCapping = -1;
613
+ hls.nextAutoLevel = -1;
633
614
  }
634
615
  }
635
616
  /** Pause, destroy HLS, and remove player from DOM and pool tracking. */
@@ -1662,7 +1643,6 @@ class EmbeddedFeedManager {
1662
1643
  this._setupScrollEnd();
1663
1644
  this._setupVisibilityHandler();
1664
1645
  this._setupCellHeightObserver();
1665
- this._setupDebugPanel();
1666
1646
  if (startIndex > 0 && startIndex < items.length) {
1667
1647
  const targetEl = this.itemEls.get(items[startIndex].id);
1668
1648
  if (targetEl) targetEl.scrollIntoView({ behavior: "instant", block: "start" });
@@ -1685,11 +1665,6 @@ class EmbeddedFeedManager {
1685
1665
  this._resizeObserver = null;
1686
1666
  }
1687
1667
  if (this._visHandler) document.removeEventListener("visibilitychange", this._visHandler);
1688
- if (this._debugKeyHandler) document.removeEventListener("keydown", this._debugKeyHandler);
1689
- if (this._debugPanel) {
1690
- this._debugPanel.remove();
1691
- this._debugPanel = null;
1692
- }
1693
1668
  this.container.innerHTML = "";
1694
1669
  this.itemEls.clear();
1695
1670
  this.items = [];
@@ -2023,55 +1998,12 @@ class EmbeddedFeedManager {
2023
1998
  this._stopTimeLoop(id);
2024
1999
  this._detachOverlay(id);
2025
2000
  }
2026
- // --- Debug panel (toggle with 'D' key) ---
2027
- _setupDebugPanel() {
2028
- const panel = document.createElement("div");
2029
- panel.id = "sk-debug-panel";
2030
- panel.style.cssText = "position:fixed;top:12px;right:12px;z-index:99999;background:rgba(0,0,0,.85);color:#0f0;font:12px/1.5 monospace;padding:10px 14px;border-radius:8px;pointer-events:none;display:none;min-width:220px;";
2031
- document.body.appendChild(panel);
2032
- this._debugPanel = panel;
2033
- this._debugVisible = false;
2034
- this._debugKeyHandler = (e) => {
2035
- if (e.key === "d" || e.key === "D") {
2036
- this._debugVisible = !this._debugVisible;
2037
- panel.style.display = this._debugVisible ? "block" : "none";
2038
- }
2039
- };
2040
- document.addEventListener("keydown", this._debugKeyHandler);
2041
- }
2042
- _updateDebugPanel() {
2043
- if (!this._debugVisible || !this._debugPanel) return;
2044
- const hls = this.pool.hlsInstances.get(this.activeItemId);
2045
- if (!hls || !hls.levels || !hls.levels.length) {
2046
- this._debugPanel.innerHTML = "HLS: no levels loaded";
2047
- return;
2048
- }
2049
- const level = hls.levels[hls.currentLevel] || {};
2050
- const bw = hls.bandwidthEstimate ? (hls.bandwidthEstimate / 1e6).toFixed(2) : "?";
2051
- const lines = [
2052
- `<b style="color:#fff">HLS Debug</b>`,
2053
- `Level: ${hls.currentLevel} / ${hls.levels.length - 1}`,
2054
- `Resolution: ${level.width || "?"}x${level.height || "?"}`,
2055
- `Bitrate: ${level.bitrate ? (level.bitrate / 1e3).toFixed(0) + " kbps" : "?"}`,
2056
- `BW estimate: ${bw} Mbps`,
2057
- `Auto cap: ${hls.autoLevelCapping}`,
2058
- `Next level: ${hls.nextLevel}`,
2059
- `<span style="color:#888">Levels:</span>`
2060
- ];
2061
- for (let i = 0; i < hls.levels.length; i++) {
2062
- const l = hls.levels[i];
2063
- const marker = i === hls.currentLevel ? ' <b style="color:#0ff">◀</b>' : "";
2064
- lines.push(` ${i}: ${l.width}x${l.height} @ ${(l.bitrate / 1e3).toFixed(0)}k${marker}`);
2065
- }
2066
- this._debugPanel.innerHTML = lines.join("<br>");
2067
- }
2068
2001
  // --- Time loop (state emission only, no DOM updates) ---
2069
2002
  _startTimeLoop(id, el, player) {
2070
2003
  this._stopTimeLoop(id);
2071
2004
  const tick = () => {
2072
2005
  if (this._destroyed) return;
2073
2006
  if (!player || player.paused) {
2074
- this._updateDebugPanel();
2075
2007
  this.rafIds.set(id, requestAnimationFrame(tick));
2076
2008
  return;
2077
2009
  }
@@ -2097,7 +2029,6 @@ class EmbeddedFeedManager {
2097
2029
  player.play().catch(() => {
2098
2030
  });
2099
2031
  }
2100
- this._updateDebugPanel();
2101
2032
  this.rafIds.set(id, requestAnimationFrame(tick));
2102
2033
  };
2103
2034
  this.rafIds.set(id, requestAnimationFrame(tick));
@@ -3163,20 +3094,11 @@ class WidgetPlayerPool {
3163
3094
  }
3164
3095
  promoteToActive(itemId) {
3165
3096
  const hls = this.hlsInstances.get(itemId);
3166
- if (!hls) return;
3167
- hls.config.maxBufferLength = WidgetPlayerPool.ACTIVE_HLS_CONFIG.maxBufferLength;
3168
- hls.config.maxMaxBufferLength = WidgetPlayerPool.ACTIVE_HLS_CONFIG.maxMaxBufferLength;
3169
- hls.autoLevelCapping = -1;
3170
- const top = hls.levels ? hls.levels.length - 1 : -1;
3171
- if (top > 0 && hls.currentLevel < top) {
3172
- hls.currentLevel = top;
3173
- const player = this.assignments.get(itemId);
3174
- if (player) {
3175
- player.currentTime = player.currentTime;
3176
- }
3177
- setTimeout(() => {
3178
- if (!hls.destroyed) hls.currentLevel = -1;
3179
- }, 4e3);
3097
+ if (hls) {
3098
+ hls.config.maxBufferLength = WidgetPlayerPool.ACTIVE_HLS_CONFIG.maxBufferLength;
3099
+ hls.config.maxMaxBufferLength = WidgetPlayerPool.ACTIVE_HLS_CONFIG.maxMaxBufferLength;
3100
+ hls.autoLevelCapping = -1;
3101
+ hls.nextAutoLevel = -1;
3180
3102
  }
3181
3103
  }
3182
3104
  _destroyHls(itemId) {
@@ -603,35 +603,16 @@
603
603
  player._skCurrentUrl = streamingUrl;
604
604
  }
605
605
  /**
606
- * Promote a preload player to active: raise buffer limits, uncap ABR, and
607
- * force an immediate quality upgrade.
608
- *
609
- * Preload streams start at level 0 (lowest rendition) to conserve bandwidth.
610
- * When attachStream() is called again with isActive=true for the same URL it
611
- * early-returns, so the HLS instance keeps its startLevel:0 config. The
612
- * already-buffered low-quality segments play through before any higher-quality
613
- * segments arrive — causing a visible low-res start even on fast connections.
614
- *
615
- * Fix: lock HLS to the highest level, then seek-in-place to flush the
616
- * low-quality buffer so the player immediately re-fetches at high quality.
617
- * Re-enable ABR after a few seconds so slow connections self-correct.
606
+ * Promote a preload player to active: raise buffer limits and uncap ABR.
607
+ * Safe to call even if the HLS instance was already created with active config.
618
608
  */
619
609
  promoteToActive(itemId) {
620
610
  const hls = this.hlsInstances.get(itemId);
621
- if (!hls) return;
622
- hls.config.maxBufferLength = PlayerPool.ACTIVE_HLS_CONFIG.maxBufferLength;
623
- hls.config.maxMaxBufferLength = PlayerPool.ACTIVE_HLS_CONFIG.maxMaxBufferLength;
624
- hls.autoLevelCapping = -1;
625
- const top = hls.levels ? hls.levels.length - 1 : -1;
626
- if (top > 0 && hls.currentLevel < top) {
627
- hls.currentLevel = top;
628
- const player = this.assignments.get(itemId);
629
- if (player) {
630
- player.currentTime = player.currentTime;
631
- }
632
- setTimeout(() => {
633
- if (!hls.destroyed) hls.currentLevel = -1;
634
- }, 4e3);
611
+ if (hls) {
612
+ hls.config.maxBufferLength = PlayerPool.ACTIVE_HLS_CONFIG.maxBufferLength;
613
+ hls.config.maxMaxBufferLength = PlayerPool.ACTIVE_HLS_CONFIG.maxMaxBufferLength;
614
+ hls.autoLevelCapping = -1;
615
+ hls.nextAutoLevel = -1;
635
616
  }
636
617
  }
637
618
  /** Pause, destroy HLS, and remove player from DOM and pool tracking. */
@@ -1664,7 +1645,6 @@
1664
1645
  this._setupScrollEnd();
1665
1646
  this._setupVisibilityHandler();
1666
1647
  this._setupCellHeightObserver();
1667
- this._setupDebugPanel();
1668
1648
  if (startIndex > 0 && startIndex < items.length) {
1669
1649
  const targetEl = this.itemEls.get(items[startIndex].id);
1670
1650
  if (targetEl) targetEl.scrollIntoView({ behavior: "instant", block: "start" });
@@ -1687,11 +1667,6 @@
1687
1667
  this._resizeObserver = null;
1688
1668
  }
1689
1669
  if (this._visHandler) document.removeEventListener("visibilitychange", this._visHandler);
1690
- if (this._debugKeyHandler) document.removeEventListener("keydown", this._debugKeyHandler);
1691
- if (this._debugPanel) {
1692
- this._debugPanel.remove();
1693
- this._debugPanel = null;
1694
- }
1695
1670
  this.container.innerHTML = "";
1696
1671
  this.itemEls.clear();
1697
1672
  this.items = [];
@@ -2025,55 +2000,12 @@
2025
2000
  this._stopTimeLoop(id);
2026
2001
  this._detachOverlay(id);
2027
2002
  }
2028
- // --- Debug panel (toggle with 'D' key) ---
2029
- _setupDebugPanel() {
2030
- const panel = document.createElement("div");
2031
- panel.id = "sk-debug-panel";
2032
- panel.style.cssText = "position:fixed;top:12px;right:12px;z-index:99999;background:rgba(0,0,0,.85);color:#0f0;font:12px/1.5 monospace;padding:10px 14px;border-radius:8px;pointer-events:none;display:none;min-width:220px;";
2033
- document.body.appendChild(panel);
2034
- this._debugPanel = panel;
2035
- this._debugVisible = false;
2036
- this._debugKeyHandler = (e) => {
2037
- if (e.key === "d" || e.key === "D") {
2038
- this._debugVisible = !this._debugVisible;
2039
- panel.style.display = this._debugVisible ? "block" : "none";
2040
- }
2041
- };
2042
- document.addEventListener("keydown", this._debugKeyHandler);
2043
- }
2044
- _updateDebugPanel() {
2045
- if (!this._debugVisible || !this._debugPanel) return;
2046
- const hls = this.pool.hlsInstances.get(this.activeItemId);
2047
- if (!hls || !hls.levels || !hls.levels.length) {
2048
- this._debugPanel.innerHTML = "HLS: no levels loaded";
2049
- return;
2050
- }
2051
- const level = hls.levels[hls.currentLevel] || {};
2052
- const bw = hls.bandwidthEstimate ? (hls.bandwidthEstimate / 1e6).toFixed(2) : "?";
2053
- const lines = [
2054
- `<b style="color:#fff">HLS Debug</b>`,
2055
- `Level: ${hls.currentLevel} / ${hls.levels.length - 1}`,
2056
- `Resolution: ${level.width || "?"}x${level.height || "?"}`,
2057
- `Bitrate: ${level.bitrate ? (level.bitrate / 1e3).toFixed(0) + " kbps" : "?"}`,
2058
- `BW estimate: ${bw} Mbps`,
2059
- `Auto cap: ${hls.autoLevelCapping}`,
2060
- `Next level: ${hls.nextLevel}`,
2061
- `<span style="color:#888">Levels:</span>`
2062
- ];
2063
- for (let i = 0; i < hls.levels.length; i++) {
2064
- const l = hls.levels[i];
2065
- const marker = i === hls.currentLevel ? ' <b style="color:#0ff">◀</b>' : "";
2066
- lines.push(` ${i}: ${l.width}x${l.height} @ ${(l.bitrate / 1e3).toFixed(0)}k${marker}`);
2067
- }
2068
- this._debugPanel.innerHTML = lines.join("<br>");
2069
- }
2070
2003
  // --- Time loop (state emission only, no DOM updates) ---
2071
2004
  _startTimeLoop(id, el, player) {
2072
2005
  this._stopTimeLoop(id);
2073
2006
  const tick = () => {
2074
2007
  if (this._destroyed) return;
2075
2008
  if (!player || player.paused) {
2076
- this._updateDebugPanel();
2077
2009
  this.rafIds.set(id, requestAnimationFrame(tick));
2078
2010
  return;
2079
2011
  }
@@ -2099,7 +2031,6 @@
2099
2031
  player.play().catch(() => {
2100
2032
  });
2101
2033
  }
2102
- this._updateDebugPanel();
2103
2034
  this.rafIds.set(id, requestAnimationFrame(tick));
2104
2035
  };
2105
2036
  this.rafIds.set(id, requestAnimationFrame(tick));
@@ -3165,20 +3096,11 @@
3165
3096
  }
3166
3097
  promoteToActive(itemId) {
3167
3098
  const hls = this.hlsInstances.get(itemId);
3168
- if (!hls) return;
3169
- hls.config.maxBufferLength = WidgetPlayerPool.ACTIVE_HLS_CONFIG.maxBufferLength;
3170
- hls.config.maxMaxBufferLength = WidgetPlayerPool.ACTIVE_HLS_CONFIG.maxMaxBufferLength;
3171
- hls.autoLevelCapping = -1;
3172
- const top = hls.levels ? hls.levels.length - 1 : -1;
3173
- if (top > 0 && hls.currentLevel < top) {
3174
- hls.currentLevel = top;
3175
- const player = this.assignments.get(itemId);
3176
- if (player) {
3177
- player.currentTime = player.currentTime;
3178
- }
3179
- setTimeout(() => {
3180
- if (!hls.destroyed) hls.currentLevel = -1;
3181
- }, 4e3);
3099
+ if (hls) {
3100
+ hls.config.maxBufferLength = WidgetPlayerPool.ACTIVE_HLS_CONFIG.maxBufferLength;
3101
+ hls.config.maxMaxBufferLength = WidgetPlayerPool.ACTIVE_HLS_CONFIG.maxMaxBufferLength;
3102
+ hls.autoLevelCapping = -1;
3103
+ hls.nextAutoLevel = -1;
3182
3104
  }
3183
3105
  }
3184
3106
  _destroyHls(itemId) {