Audio plays only the first time the callback is called
Open
Nobody has claimed this yet.
bug
P3
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
When I call the html.Audio via a callback trigger, it plays for the first time. If I repeat the same trigger on the same page, it doesn't work, any idea?
The trigger event is button click (id=submit_query).
def play_audio_alert():
return html.Audio(autoPlay=True, src= '/assets/query_sound.wav')
@app.callback( [
Output(component_id='sound_notification', component_property='children'),
],
[
Input('submit_query', 'n_clicks')
],
def user_query(button_n_click):
if button_n_click!= None and button_n_click >0 :
return play_audio_alert()
app.layout = html.Div([ dcc.Location(id='url', refresh=False),
html.Div(id='page-content'),
html.Div(id='sound_notification')
])
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the callback triggered by the submit_query button, which returns html.Audio into sound_notification, and compare the first and repeated clicks. Done means the audio plays on every trigger on the same page; the payload names no source file or test to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100