Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pyi_hashes.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
28 changes: 21 additions & 7 deletions reflex/components/react_player/react_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]

Expand Down Expand Up @@ -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),
)
)
Loading