0

I am unable to play audio from the server but When I click on sample.html the audio is playing. I am sharing the code below. Please suggest , how can rectify this problem? html code:

<html>
<head>
<body>
<audio controls
src="a.wav"
  autoplay>
  Your browser does not support the <code>audio</code> element.
</audio>
</body>
</html>

flask api:

@app.route('/sample')
def sample():
    return render_template('sample.html')  

any one please in this help?

  • did you send `a.wav` on server? Did you put it in correct folder? Server may serve static file only if they are in special folder. Did you check if you have any error message in JavaScript console in web browser? Did you test it with different browser? Maybe in your browser is setting which stops autoplaying from external servers - so it can be problem only with web browser. So check in google `autoplay in web browser`. ie [How to make audio autoplay on chrome](https://stackoverflow.com/questions/50490304/how-to-make-audio-autoplay-on-chrome) – furas Jun 10 '21 at 11:40

0 Answers0