diff --git a/pyi_hashes.json b/pyi_hashes.json index bd1389e0a25..5aeba2d48f7 100644 --- a/pyi_hashes.json +++ b/pyi_hashes.json @@ -111,9 +111,9 @@ "reflex/components/radix/themes/typography/heading.pyi": "5a3b0b8e44bda0fce22c6b1a1f25e68e", "reflex/components/radix/themes/typography/link.pyi": "45965d95b9f9b76f8f4a3084a5430194", "reflex/components/radix/themes/typography/text.pyi": "e6aa0ca43ebbd42701a3c72c0312032e", - "reflex/components/react_player/audio.pyi": "972975ed0ba3e1dc4a867da20b11ae8e", - "reflex/components/react_player/react_player.pyi": "63ffffbc24907103f797dcfd85894107", - "reflex/components/react_player/video.pyi": "35ce5ad62e8bff17d9c09d27c362f8dc", + "reflex/components/react_player/audio.pyi": "18fb682ec86d1b44682e1903dff11794", + "reflex/components/react_player/react_player.pyi": "171d829b30c1c0c62e49e4a21cffe50f", + "reflex/components/react_player/video.pyi": "5c93cfe85ba4dcadfddae94a2e36bb4e", "reflex/components/recharts/__init__.pyi": "a52c9055e37c6ee25ded15688d45e8a5", "reflex/components/recharts/cartesian.pyi": "9dd16c08abe5205c6c414474e2de2f79", "reflex/components/recharts/charts.pyi": "3570af4627c601d10ee37033f1b2329c", diff --git a/reflex/components/react_player/react_player.py b/reflex/components/react_player/react_player.py index 44a11d26d6c..43dd1577b5f 100644 --- a/reflex/components/react_player/react_player.py +++ b/reflex/components/react_player/react_player.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import TypedDict +from typing import Any, TypedDict from reflex.components.component import NoSSRComponent from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec @@ -50,12 +50,6 @@ class ReactPlayer(NoSSRComponent): # Mutes the player muted: Var[bool] - # Set the width of the player: ex:640px - width: Var[str] - - # Set the height of the player: ex:640px - height: Var[str] - # Called when media is loaded and ready to play. If playing is set to true, media will play immediately. on_ready: EventHandler[no_args_event_spec] @@ -103,3 +97,23 @@ class ReactPlayer(NoSSRComponent): # Called when picture-in-picture mode is disabled. on_disable_pip: EventHandler[no_args_event_spec] + + def _render(self, props: dict[str, Any] | None = None): + """Render the component. Adds width and height set to None because + react-player will set them to some random value that overrides the + css width and height. + + Args: + props: The props to pass to the component. + + Returns: + The rendered component. + """ + return ( + super() + ._render(props) + .add_props( + width=Var.create(None), + height=Var.create(None), + ) + )