I have added an html.Audio component to my App as follows:
html.Div([html.Div([html.Div(id='audio-message', className= "six columns")], className="row"),
text = ‘testing test test one two three’
myobj = gTTS(text=text, lang='en', slow=False) if 'test.mp3' in os.listdir(os.path.join(dirpath, 'assets')): os.remove(os.path.join(dirpath, 'assets', 'test.mp3')) myobj.save("assets/test.mp3") audio = html.Audio(id='audio', src='assets/test.mp3', controls=True, autoPlay=True) return message, audio
Now the strange thing that happens is that the audio file gets saved in the assets folder. And (depending on how fast the PC is), it will after it is being loaded, be spoken by a voice, but only for a tiny moment, after which the complete App restores/refreshes. Then I have lost all my data and calculations and the complete .mp3 file has not even been completely spoken. Unfortunately, I am unable to find the problem… hope you guys may know what is going on here.
Please let me know if more information is required.