@mebius-io/web 0.4.4 → 0.4.6

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.
@@ -42916,21 +42916,20 @@ Schedule: ${scheduleItems.map((seg) => segmentToString(seg))} pos: ${this.timeli
42916
42916
  const { signal } = this.listeners;
42917
42917
  video.addEventListener("ended", () => this.endedCb?.(), { signal });
42918
42918
  video.addEventListener("waiting", () => this.bufferingCb?.(), { signal });
42919
- if (video.canPlayType("application/vnd.apple.mpegurl")) {
42919
+ let Hls2 = null;
42920
+ try {
42921
+ Hls2 = (await Promise.resolve().then(() => (init_hls(), hls_exports))).default;
42922
+ } catch {
42923
+ Hls2 = null;
42924
+ }
42925
+ if (!Hls2?.isSupported()) {
42926
+ if (!video.canPlayType("application/vnd.apple.mpegurl")) {
42927
+ throw mebiusError("CONNECTION_FAILED", "Scale playback is not supported in this browser.");
42928
+ }
42920
42929
  video.src = url;
42921
42930
  this.mutedByPolicy = (await playWithAutoplayFallback(video)).mutedByPolicy;
42922
42931
  return;
42923
42932
  }
42924
- let mod;
42925
- try {
42926
- mod = await Promise.resolve().then(() => (init_hls(), hls_exports));
42927
- } catch (cause) {
42928
- throw mebiusError("CONNECTION_FAILED", "Scale playback support failed to load.", cause);
42929
- }
42930
- const Hls2 = mod.default;
42931
- if (!Hls2.isSupported()) {
42932
- throw mebiusError("CONNECTION_FAILED", "Scale playback is not supported in this browser.");
42933
- }
42934
42933
  const hls = new Hls2({ maxLiveSyncPlaybackRate: 1.5 });
42935
42934
  this.hls = hls;
42936
42935
  hls.on(Hls2.Events.ERROR, (_evt, data) => {
@@ -42974,7 +42973,7 @@ Schedule: ${scheduleItems.map((seg) => segmentToString(seg))} pos: ${this.timeli
42974
42973
  var MAX_DRIFT_S = 2;
42975
42974
  var EDGE_MARGIN_S = 0.4;
42976
42975
  var AUDIO_RETRY_MS = 2500;
42977
- function stalledAtZero(video, ms) {
42976
+ function stalledWithData(video, ms) {
42978
42977
  if (video.currentTime > 0) return Promise.resolve(false);
42979
42978
  return new Promise((resolve) => {
42980
42979
  const done = (stalled) => {
@@ -42985,7 +42984,7 @@ Schedule: ${scheduleItems.map((seg) => segmentToString(seg))} pos: ${this.timeli
42985
42984
  const onTime = () => {
42986
42985
  if (video.currentTime > 0) done(false);
42987
42986
  };
42988
- const timer = setTimeout(() => done(true), ms);
42987
+ const timer = setTimeout(() => done(video.buffered.length > 0 && video.currentTime === 0), ms);
42989
42988
  video.addEventListener("timeupdate", onTime);
42990
42989
  });
42991
42990
  }
@@ -43036,7 +43035,7 @@ Schedule: ${scheduleItems.map((seg) => segmentToString(seg))} pos: ${this.timeli
43036
43035
  this.attachPlayer(flvjs, video, url, true);
43037
43036
  const firstPlay = playWithAutoplayFallback(video);
43038
43037
  firstPlay.catch(() => void 0);
43039
- if (await stalledAtZero(video, AUDIO_RETRY_MS)) {
43038
+ if (await stalledWithData(video, AUDIO_RETRY_MS)) {
43040
43039
  this.teardownPlayer();
43041
43040
  this.attachPlayer(flvjs, video, url, false);
43042
43041
  this.mutedByPolicy = (await playWithAutoplayFallback(video)).mutedByPolicy;
@@ -43113,7 +43112,7 @@ Schedule: ${scheduleItems.map((seg) => segmentToString(seg))} pos: ${this.timeli
43113
43112
  }
43114
43113
 
43115
43114
  // src/internal/telemetry.ts
43116
- var SDK_VERSION = "web/0.4.4";
43115
+ var SDK_VERSION = "web/0.4.6";
43117
43116
  var FLUSH_INTERVAL_MS = 15e3;
43118
43117
  var MAX_BATCH = 64;
43119
43118
  function describeDevice() {
@@ -43368,6 +43367,9 @@ Schedule: ${scheduleItems.map((seg) => segmentToString(seg))} pos: ${this.timeli
43368
43367
  }
43369
43368
  await candidate.stop().catch(() => void 0);
43370
43369
  }
43370
+ this.elementListeners?.abort();
43371
+ this.elementListeners = null;
43372
+ if (ELEMENT_OWNER.get(video) === this) ELEMENT_OWNER.delete(video);
43371
43373
  this.video = null;
43372
43374
  throw lastError ?? mebiusError("CONNECTION_FAILED", "No Mebius route could play this stream.");
43373
43375
  }