@livo-tv/blocks 1.37.0 → 1.37.1-pr.7.a5dd35c

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/video.cjs CHANGED
@@ -2942,9 +2942,23 @@ var liveEdgeErrorRetry = {
2942
2942
  backoff: "exponential",
2943
2943
  shouldRetry: shouldRetryLiveEdge404
2944
2944
  };
2945
- function createLiveHlsConfig() {
2945
+ function isIosHlsHost(userAgent, maxTouchPoints = 0) {
2946
+ if (/iP(hone|od|ad)/i.test(userAgent)) return true;
2947
+ return /Macintosh/i.test(userAgent) && maxTouchPoints > 1;
2948
+ }
2949
+ function shouldEnableHlsWorker(userAgent, maxTouchPoints) {
2950
+ const ua = userAgent ?? (typeof navigator === "undefined" ? "" : navigator.userAgent);
2951
+ const points = maxTouchPoints ?? (typeof navigator === "undefined" ? 0 : navigator.maxTouchPoints);
2952
+ return !isIosHlsHost(ua, points);
2953
+ }
2954
+ function createLiveHlsConfig(options = {}) {
2946
2955
  return {
2947
- enableWorker: true,
2956
+ enableWorker: shouldEnableHlsWorker(
2957
+ options.userAgent,
2958
+ options.maxTouchPoints
2959
+ ),
2960
+ lowLatencyMode: false,
2961
+ liveDurationInfinity: true,
2948
2962
  // No custom request headers: Cache-Control/Pragma are not
2949
2963
  // CORS-safelisted and would force an OPTIONS preflight before every
2950
2964
  // manifest poll and segment fetch. Freshness is controlled by the
@@ -3002,6 +3016,9 @@ function errorMessageFromUnknown(error) {
3002
3016
  if (typeof error === "string") return error;
3003
3017
  return void 0;
3004
3018
  }
3019
+ function isHlsPlaylistParseError(details) {
3020
+ return details === "levelParsingError" || details === "manifestParsingError";
3021
+ }
3005
3022
  function isNotFound(httpStatus, details) {
3006
3023
  return httpStatus === 404 || details === "manifestLoadError" || details === "levelLoadError" || details === "fragLoadError";
3007
3024
  }
@@ -3156,6 +3173,7 @@ function useHlsPlayback({
3156
3173
  let retryTimer = null;
3157
3174
  let manifestParsed = false;
3158
3175
  let mediaErrorRetries = 0;
3176
+ let recoveredParseError = false;
3159
3177
  let playbackSource = "hls";
3160
3178
  const teardown = [];
3161
3179
  const liveSrc = isLivePlaylistSrc(src);
@@ -3427,6 +3445,27 @@ function useHlsPlayback({
3427
3445
  context: baseContext()
3428
3446
  })
3429
3447
  );
3448
+ if (isHlsPlaylistParseError(data.details)) {
3449
+ if (!recoveredParseError) {
3450
+ recoveredParseError = true;
3451
+ scheduleRetry(() => initHlsJs(Hls));
3452
+ return;
3453
+ }
3454
+ if (data.fatal) {
3455
+ reportFatal({
3456
+ source: "hls",
3457
+ type: data.type,
3458
+ details: data.details,
3459
+ fatal: true,
3460
+ url: data.url,
3461
+ response: data.response,
3462
+ reason: data.reason,
3463
+ error: data.error,
3464
+ context: baseContext()
3465
+ });
3466
+ }
3467
+ return;
3468
+ }
3430
3469
  if (!data.fatal) return;
3431
3470
  if (data.type === Hls.ErrorTypes.NETWORK_ERROR) {
3432
3471
  if (!manifestParsed) {
@@ -5129,6 +5168,8 @@ exports.createVodHlsConfig = createVodHlsConfig;
5129
5168
  exports.describeAvResync = describeAvResync;
5130
5169
  exports.describePlaybackError = describePlaybackError;
5131
5170
  exports.isCaptionLocale = isCaptionLocale;
5171
+ exports.isHlsPlaylistParseError = isHlsPlaylistParseError;
5172
+ exports.isIosHlsHost = isIosHlsHost;
5132
5173
  exports.isShaderCurtainKind = isShaderCurtainKind;
5133
5174
  exports.liveCaptionsUrl = liveCaptionsUrl;
5134
5175
  exports.loadCastSender = loadCastSender;
@@ -5136,6 +5177,7 @@ exports.loadLiveCaptions = loadLiveCaptions;
5136
5177
  exports.mergeLiveCaptionCues = mergeLiveCaptionCues;
5137
5178
  exports.mergeShaderCurtainConfig = mergeShaderCurtainConfig;
5138
5179
  exports.parseShaderGradientUrl = parseShaderGradientUrl;
5180
+ exports.shouldEnableHlsWorker = shouldEnableHlsWorker;
5139
5181
  exports.shouldRetryLiveEdge404 = shouldRetryLiveEdge404;
5140
5182
  exports.toShaderGradientUrl = toShaderGradientUrl;
5141
5183
  exports.useFeedExclusivePlayback = useFeedExclusivePlayback;