-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add playback_position to gr.Audio and gr.Video, which can be updated and read
#12504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-pypi-previews.s3.amazonaws.com/919949ba1569dada0288161f6da4310ab205dc9e/gradio-6.0.2-py3-none-any.whlInstall Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@919949ba1569dada0288161f6da4310ab205dc9e#subdirectory=client/python"Install Gradio JS Client from this PR npm install https://gradio-npm-previews.s3.amazonaws.com/919949ba1569dada0288161f6da4310ab205dc9e/gradio-client-2.0.0.tgz |
🦄 change detectedThis Pull Request includes changes to the following packages.
✅ Changeset approved by @freddyaboulton
|
freddyaboulton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it. It works great. My one comment would be to do this via a playback_state prop that is a dict/dataclass (similar to WaveformOptions). That way if we want to add props for play/pause/playback speed in the future we can do so without having to add separate params.
js/audio/player/AudioPlayer.svelte
Outdated
| waveform?.on("decode", (duration: any) => { | ||
| audio_duration = duration; | ||
| console.log("Audio duration:", audio_duration); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console log
dawoodkhan82
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, works great
I disagree with this, I think its best that we keep those as separate arguments, because a) its cleaner and b) you won't be able to update just one of those properties if you want to update with an event listener. |
|
Such a great feature! It'd be cool to build a practical demo around this & do some nice visibility internally and externally. For example, an app that transcribes an audio file with timestamp and as the audio is playing, it higlights the current word/sentence. |
|
Great! Let's merge and do the release |
this playback_position argument value can be set, e.g.
or read, e.g.
See demo/playback_position for examples