|
@@ -7,7 +7,11 @@ register_component('audio', __file__, 'audio.js')
|
|
|
class Audio(Element):
|
|
|
|
|
|
def __init__(self, src: str, *,
|
|
|
- type: str = 'audio/mpeg', controls: bool = True, autoplay: bool = False, muted: bool = False) -> None:
|
|
|
+ type: str = 'audio/mpeg',
|
|
|
+ controls: bool = True,
|
|
|
+ autoplay: bool = False,
|
|
|
+ muted: bool = False,
|
|
|
+ loop: bool = False) -> None:
|
|
|
"""Audio
|
|
|
|
|
|
:param src: URL of the audio source
|
|
@@ -15,6 +19,7 @@ class Audio(Element):
|
|
|
:param controls: whether to show the audio controls, like play, pause, and volume (default: `True`)
|
|
|
:param autoplay: whether to start playing the audio automatically (default: `False`)
|
|
|
:param muted: whether the audio should be initially muted (default: `False`)
|
|
|
+ :param loop: whether the audio should loop (default: `False`)
|
|
|
|
|
|
See `here <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio#events>`_
|
|
|
for a list of events you can subscribe to using the generic event subscription `on()`.
|
|
@@ -25,3 +30,4 @@ class Audio(Element):
|
|
|
self._props['controls'] = controls
|
|
|
self._props['autoplay'] = autoplay
|
|
|
self._props['muted'] = muted
|
|
|
+ self._props['loop'] = loop
|