@ldelia/react-media 0.6.0 → 0.6.1

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.
@@ -1,4 +1,4 @@
1
- import React, { useRef } from 'react';
1
+ import React, { useEffect, useRef } from 'react';
2
2
  import ReactPlayer from 'react-player/lazy';
3
3
  export const YouTubeInnerPlayer = ({ videoId, onReady, onVideoUnavailable }) => {
4
4
  const hasErrorRef = useRef(false);
@@ -35,5 +35,13 @@ export const YouTubeInnerPlayer = ({ videoId, onReady, onVideoUnavailable }) =>
35
35
  console.warn('Unhandled YouTube error:', error);
36
36
  }
37
37
  };
38
+ // Reset refs when videoId changes
39
+ useEffect(() => {
40
+ hasErrorRef.current = false;
41
+ if (readyTimeoutRef.current) {
42
+ clearTimeout(readyTimeoutRef.current);
43
+ readyTimeoutRef.current = null;
44
+ }
45
+ }, [videoId]);
38
46
  return (React.createElement(ReactPlayer, { url: `https://www.youtube.com/watch?v=${videoId}`, onReady: handleReady, onError: handleError }));
39
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ldelia/react-media",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "A React components collection for media-related features.",
5
5
  "private": false,
6
6
  "keywords": [