|
@@ -1,3 +1,5 @@
|
|
|
|
+import warnings
|
|
|
|
+
|
|
from ..dependencies import register_component
|
|
from ..dependencies import register_component
|
|
from ..element import Element
|
|
from ..element import Element
|
|
|
|
|
|
@@ -7,15 +9,15 @@ register_component('audio', __file__, 'audio.js')
|
|
class Audio(Element):
|
|
class Audio(Element):
|
|
|
|
|
|
def __init__(self, src: str, *,
|
|
def __init__(self, src: str, *,
|
|
- type: str = 'audio/mpeg',
|
|
|
|
controls: bool = True,
|
|
controls: bool = True,
|
|
autoplay: bool = False,
|
|
autoplay: bool = False,
|
|
muted: bool = False,
|
|
muted: bool = False,
|
|
- loop: bool = False) -> None:
|
|
|
|
|
|
+ loop: bool = False,
|
|
|
|
+ type: str = '', # DEPRECATED
|
|
|
|
+ ) -> None:
|
|
"""Audio
|
|
"""Audio
|
|
|
|
|
|
:param src: URL of the audio source
|
|
:param src: URL of the audio source
|
|
- :param type: MIME-type of the resource (default: 'audio/mpeg')
|
|
|
|
:param controls: whether to show the audio controls, like play, pause, and volume (default: `True`)
|
|
: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 autoplay: whether to start playing the audio automatically (default: `False`)
|
|
:param muted: whether the audio should be initially muted (default: `False`)
|
|
:param muted: whether the audio should be initially muted (default: `False`)
|
|
@@ -26,8 +28,11 @@ class Audio(Element):
|
|
"""
|
|
"""
|
|
super().__init__('audio')
|
|
super().__init__('audio')
|
|
self._props['src'] = src
|
|
self._props['src'] = src
|
|
- self._props['type'] = type
|
|
|
|
self._props['controls'] = controls
|
|
self._props['controls'] = controls
|
|
self._props['autoplay'] = autoplay
|
|
self._props['autoplay'] = autoplay
|
|
self._props['muted'] = muted
|
|
self._props['muted'] = muted
|
|
self._props['loop'] = loop
|
|
self._props['loop'] = loop
|
|
|
|
+
|
|
|
|
+ if type:
|
|
|
|
+ url = f'https://github.com/zauberzeug/nicegui/pull/624'
|
|
|
|
+ warnings.warn(DeprecationWarning(f'The type parameter for ui.audio is deprecated and ineffective ({url}).'))
|