react_player.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. """React-Player component."""
  2. from __future__ import annotations
  3. from reflex.components.component import NoSSRComponent
  4. from reflex.vars import Var
  5. class ReactPlayerComponent(NoSSRComponent):
  6. """Using react-player and not implement all props and callback yet.
  7. reference: https://github.com/cookpete/react-player.
  8. """
  9. library = "react-player/lazy"
  10. tag = "ReactPlayer"
  11. # The url of a video or song to play
  12. url: Var[str]
  13. # Set to true or false to pause or play the media
  14. playing: Var[str]
  15. # Set to true or false to loop the media
  16. loop: Var[bool]
  17. # Set to true or false to display native player controls.
  18. controls: Var[bool] = True # type: ignore
  19. # Set to true to show just the video thumbnail, which loads the full player on click
  20. light: Var[bool]
  21. # Set the volume of the player, between 0 and 1
  22. volume: Var[float]
  23. # Mutes the player
  24. muted: Var[bool]
  25. # Set the width of the player: ex:640px
  26. width: Var[str]
  27. # Set the height of the player: ex:640px
  28. height: Var[str]