sanity-plugin-mux-input 2.6.0 → 2.7.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.
package/dist/index.mjs CHANGED
@@ -280,8 +280,8 @@ function assetExistsInSanity(asset, existingAssets) {
280
280
  (existing) => existing.assetId === asset.id || existing.uploadId === asset.upload_id
281
281
  );
282
282
  }
283
- function useInView(options = {}) {
284
- const [inView, setInView] = useState(!1), ref = useRef(null);
283
+ function useInView(ref, options = {}) {
284
+ const [inView, setInView] = useState(!1);
285
285
  return useEffect(() => {
286
286
  if (!ref.current) return;
287
287
  const observer = new IntersectionObserver(([entry], obs) => {
@@ -291,7 +291,7 @@ function useInView(options = {}) {
291
291
  return observer.observe(toObserve), () => {
292
292
  toObserve && observer.unobserve(toObserve);
293
293
  };
294
- }, [options]), { inView, ref };
294
+ }, [options, ref]), inView;
295
295
  }
296
296
  const _id = "secrets.mux";
297
297
  function readSecrets(client) {
@@ -398,7 +398,7 @@ function VideoThumbnail({
398
398
  width,
399
399
  staticImage = !1
400
400
  }) {
401
- const { inView, ref } = useInView(), posterWidth = width || 250, [status, setStatus] = useState("loading"), client = useClient(), src = useMemo(() => {
401
+ const ref = useRef(null), inView = useInView(ref), posterWidth = width || 250, [status, setStatus] = useState("loading"), client = useClient(), src = useMemo(() => {
402
402
  try {
403
403
  let thumbnail;
404
404
  return staticImage ? thumbnail = getPosterSrc({ asset, client, width: posterWidth }) : thumbnail = getAnimatedPosterSrc({ asset, client, width: posterWidth }), thumbnail;
@@ -465,9 +465,7 @@ function VideoThumbnail({
465
465
  alt: `Preview for ${staticImage ? "image" : "video"} ${asset.filename || asset.assetId}`,
466
466
  onLoad: handleLoad,
467
467
  onError: handleError,
468
- style: {
469
- opacity: status === "loaded" ? 1 : 0
470
- }
468
+ style: { opacity: status === "loaded" ? 1 : 0 }
471
469
  }
472
470
  )
473
471
  ] }) : null
@@ -918,7 +916,7 @@ function VideoPlayer({
918
916
  crossOrigin: "anonymous",
919
917
  metadata: {
920
918
  player_name: "Sanity Admin Dashboard",
921
- player_version: "2.6.0",
919
+ player_version: "2.7.0",
922
920
  page_type: "Preview Player"
923
921
  },
924
922
  audio: isAudio,