diff --git a/packages/2d/src/lib/scenes/Scene2D.ts b/packages/2d/src/lib/scenes/Scene2D.ts index 14f4fd15..a3b6daad 100644 --- a/packages/2d/src/lib/scenes/Scene2D.ts +++ b/packages/2d/src/lib/scenes/Scene2D.ts @@ -220,7 +220,6 @@ export class Scene2D extends GeneratorScene implements Inspectable { for (const media of mediaNodes) { media.setVolume(media.getVolume() * volumeScale); - console.log(media.key); } } diff --git a/packages/player-react/src/index.tsx b/packages/player-react/src/index.tsx index 90787f9a..0e63b9d3 100644 --- a/packages/player-react/src/index.tsx +++ b/packages/player-react/src/index.tsx @@ -14,6 +14,7 @@ interface RevideoPlayerProps { height?: number; quality?: number; fps?: number; + volume?: number; } declare global { @@ -140,19 +141,18 @@ export function Player({ const handlePlayerResize = useCallback( (entries: ResizeObserverEntry[]) => { const [firstEntry] = entries; - if (!firstEntry || !wrapperRef.current) { + if (!firstEntry || !wrapperRef.current || !lastRect.current) { return; } const newRect = firstEntry.contentRect; - const sameWidth = newRect.width === lastRect.current.width; - const sameHeight = newRect.height === lastRect.current.height; - if (lastRect.current && sameWidth && sameHeight) { - return; + if ( + newRect.width !== lastRect.current.width || + newRect.height !== lastRect.current.height + ) { + lastRect.current = newRect; + onPlayerResize(newRect); } - - lastRect.current = newRect; - onPlayerResize(newRect); }, [onPlayerResize], ); @@ -234,6 +234,7 @@ export function Player({ height={height} quality={quality} fps={fps} + volume={volumeState} />