
* add workflow to check dependencies on release branch * rename action to follow convention of other actions * update workflow * bump poetry version * relock deps * update check to ignore pyright and ruff * oops, you saw nothing * split dep check in two job * fix frontend dep check * fix stuff * hmm yeah * nope nope nope * sigh * bump js versions for some packages * fix some warnings in tests * fix tests * try some options * try to set asyncio policy * debug dep check * fix attempt for backend dep * clean up output for backend check * run bun outdated on reflex-web to catch most of the packages * fix python version * fix python version * add missing env * fix bun command * fix workdir of frontend check * update packages version * up-pin plotly.js version * add debug ouput * clean frontend dep check output * fix output * fix async tests for redis * relock poetry.lock * Non-async functions do not need pytest_asyncio.fixture * test_state: close StateManagerRedis connection in test to avoid warning --------- Co-authored-by: Masen Furer <m_github@0x26.net>
95 lines
3.0 KiB
Python
95 lines
3.0 KiB
Python
"""React-Player component."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from reflex.components.component import NoSSRComponent
|
|
from reflex.event import EventHandler
|
|
from reflex.vars.base import Var
|
|
|
|
|
|
class ReactPlayer(NoSSRComponent):
|
|
"""Using react-player and not implement all props and callback yet.
|
|
reference: https://github.com/cookpete/react-player.
|
|
"""
|
|
|
|
library = "react-player@2.16.0"
|
|
|
|
tag = "ReactPlayer"
|
|
|
|
is_default = True
|
|
|
|
# The url of a video or song to play
|
|
url: Var[str]
|
|
|
|
# Set to true or false to pause or play the media
|
|
playing: Var[bool]
|
|
|
|
# Set to true or false to loop the media
|
|
loop: Var[bool]
|
|
|
|
# Set to true or false to display native player controls.
|
|
controls: Var[bool] = True # type: ignore
|
|
|
|
# Set to true to show just the video thumbnail, which loads the full player on click
|
|
light: Var[bool]
|
|
|
|
# Set the volume of the player, between 0 and 1
|
|
volume: Var[float]
|
|
|
|
# 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[lambda: []]
|
|
|
|
# Called when media starts playing.
|
|
on_start: EventHandler[lambda: []]
|
|
|
|
# Called when media starts or resumes playing after pausing or buffering.
|
|
on_play: EventHandler[lambda: []]
|
|
|
|
# Callback containing played and loaded progress as a fraction, and playedSeconds and loadedSeconds in seconds. eg { played: 0.12, playedSeconds: 11.3, loaded: 0.34, loadedSeconds: 16.7 }
|
|
on_progress: EventHandler[lambda progress: [progress]]
|
|
|
|
# Callback containing duration of the media, in seconds.
|
|
on_duration: EventHandler[lambda seconds: [seconds]]
|
|
|
|
# Called when media is paused.
|
|
on_pause: EventHandler[lambda: []]
|
|
|
|
# Called when media starts buffering.
|
|
on_buffer: EventHandler[lambda: []]
|
|
|
|
# Called when media has finished buffering. Works for files, YouTube and Facebook.
|
|
on_buffer_end: EventHandler[lambda: []]
|
|
|
|
# Called when media seeks with seconds parameter.
|
|
on_seek: EventHandler[lambda seconds: [seconds]]
|
|
|
|
# Called when playback rate of the player changed. Only supported by YouTube, Vimeo (if enabled), Wistia, and file paths.
|
|
on_playback_rate_change: EventHandler[lambda e0: []]
|
|
|
|
# Called when playback quality of the player changed. Only supported by YouTube (if enabled).
|
|
on_playback_quality_change: EventHandler[lambda e0: []]
|
|
|
|
# Called when media finishes playing. Does not fire when loop is set to true.
|
|
on_ended: EventHandler[lambda: []]
|
|
|
|
# Called when an error occurs whilst attempting to play media.
|
|
on_error: EventHandler[lambda: []]
|
|
|
|
# Called when user clicks the light mode preview.
|
|
on_click_preview: EventHandler[lambda: []]
|
|
|
|
# Called when picture-in-picture mode is enabled.
|
|
on_enable_pip: EventHandler[lambda: []]
|
|
|
|
# Called when picture-in-picture mode is disabled.
|
|
on_disable_pip: EventHandler[lambda: []]
|