react_player.py 1.2 KB

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