react_player.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. is_default = True
  12. # The url of a video or song to play
  13. url: Var[str]
  14. # Set to true or false to pause or play the media
  15. playing: Var[str]
  16. # Set to true or false to loop the media
  17. loop: Var[bool]
  18. # Set to true or false to display native player controls.
  19. controls: Var[bool] = True # type: ignore
  20. # Set to true to show just the video thumbnail, which loads the full player on click
  21. light: Var[bool]
  22. # Set the volume of the player, between 0 and 1
  23. volume: Var[float]
  24. # Mutes the player
  25. muted: Var[bool]
  26. # Set the width of the player: ex:640px
  27. width: Var[str]
  28. # Set the height of the player: ex:640px
  29. height: Var[str]