-
-
Notifications
You must be signed in to change notification settings - Fork 613
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1741 from wgong/pr_audio_video
submit audio/video control PR
- Loading branch information
Showing
6 changed files
with
57 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
from nicegui import ui | ||
|
||
from ..documentation_tools import text_demo | ||
|
||
|
||
def main_demo() -> None: | ||
a = ui.audio('https://cdn.pixabay.com/download/audio/2022/02/22/audio_d1718ab41b.mp3') | ||
a.on('ended', lambda _: ui.notify('Audio playback completed')) | ||
|
||
ui.button(on_click=lambda: a.props('muted'), icon='volume_off').props('outline') | ||
ui.button(on_click=lambda: a.props(remove='muted'), icon='volume_up').props('outline') | ||
|
||
|
||
def more() -> None: | ||
@text_demo('Control the audio element', ''' | ||
This demo shows how to play, pause and seek programmatically. | ||
''') | ||
def control_demo() -> None: | ||
a = ui.audio('https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3') | ||
ui.button('Play', on_click=a.play) | ||
ui.button('Pause', on_click=a.pause) | ||
ui.button('Jump to 0:30', on_click=lambda: a.seek(30)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters