The version I am using is 1.45.0.I checked the official documentation, in this version and even in earlier versions,there is no key in the parameters of st.audio.
Similar to the usage of key in st.button:st.audio(f"voices_hands/{class_name_ti10}.wav", autoplay=True,key = str(time.time()))
I try to use the current time as the only value for the key.
I want to play the wav language file generated by the model for a gesture when it is recognized in real-time, but when a certain gesture is recognized a second time, it triggers ‘StreamlitDuplicateElementId: There are multiple audio elements with the same auto-generated ID’.
Similar to the usage of key in st.button:st.audio(f"voices_hands/{class_name_ti10}.wav", autoplay=True,key = str(time.time()))
I try to use the current time as the only value for the key.
I want to play the wav language file generated by the model for a gesture when it is recognized in real-time, but when a certain gesture is recognized a second time, it triggers ‘StreamlitDuplicateElementId: There are multiple audio elements with the same auto-generated ID’.
Unfortunately, I can’t figure out any solution that works with autoplay=True. If you set sample_rate=, that removes the error, but raises a warning about that parameter being invalid, and causes the autoplay to not work.
If you can remove the autoplay, that seems to fix it.
Error: There are multiple audio elements with the same auto-generated ID. When this element is created, it is assigned an internal ID based on the element type and provided parameters. Multiple elements with the same type and parameters will cause this error.
To fix this error, please pass a unique key argument to the audio element.
But when I uncomment the # key=str(time.time()) got a different error:
MediaMixin.audio() got an unexpected keyword argument ‘key’