@mux/ai 0.23.0 → 0.25.0

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.
@@ -827,19 +827,30 @@ function getShotsPath(assetId) {
827
827
  return `/video/v1/assets/${assetId}/shots`;
828
828
  }
829
829
  function mapManifestShots(shots) {
830
- return shots.map((shot, index) => {
831
- const { start_time: startTime, image_url: imageUrl } = shot;
830
+ let usedDeprecatedField = false;
831
+ const mapped = shots.map((shot, index) => {
832
+ const { start_time: startTime } = shot;
833
+ const imageUrl = shot.shot_preview_image_url ?? shot.image_url;
834
+ if (shot.shot_preview_image_url === void 0 && shot.image_url !== void 0) {
835
+ usedDeprecatedField = true;
836
+ }
832
837
  if (typeof startTime !== "number" || !Number.isFinite(startTime)) {
833
838
  throw new TypeError(`Invalid shot start_time in shots manifest at index ${index}`);
834
839
  }
835
840
  if (typeof imageUrl !== "string" || imageUrl.length === 0) {
836
- throw new TypeError(`Invalid shot image_url in shots manifest at index ${index}`);
841
+ throw new TypeError(`Invalid shot shot_preview_image_url in shots manifest at index ${index}`);
837
842
  }
838
843
  return {
839
844
  startTime,
840
845
  imageUrl
841
846
  };
842
847
  });
848
+ if (usedDeprecatedField) {
849
+ console.warn(
850
+ "The 'image_url' field in the Mux shots manifest is deprecated and will be removed. Use 'shot_preview_image_url' instead."
851
+ );
852
+ }
853
+ return mapped;
843
854
  }
844
855
  async function fetchShotsFromManifest(shotsManifestUrl) {
845
856
  const response = await fetch(shotsManifestUrl);
@@ -1483,7 +1494,8 @@ function getReliableLanguageCode(track, confidenceThreshold = LOW_CONFIDENCE_THR
1483
1494
  return void 0;
1484
1495
  if (isUndeterminedLanguageCode(track.language_code))
1485
1496
  return void 0;
1486
- if (track.auto_language_confidence !== void 0 && track.auto_language_confidence < confidenceThreshold) {
1497
+ const { auto_language_confidence: autoLanguageConfidence } = track;
1498
+ if (autoLanguageConfidence !== void 0 && autoLanguageConfidence < confidenceThreshold) {
1487
1499
  return void 0;
1488
1500
  }
1489
1501
  return track.language_code;