plotly / plotly/dash

Audio plays only the first time the callback is called

Open
#1,773 1 comment 8 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.