Liveview: audio.source tags are not updated


I created a simple app to read and listen small stories. The issue is that when I navigate to next story and hit play button for audio, browser plays audio file from previous page. I have to hit refresh page button to listen current story audio. The same issue with Firefox and MS Edge. What am I doing wrong?

Show story page:

The audio tag has a specific behavior: javascript - How to force the HTML5 Audio tag to reload a (changing) file - Stack Overflow

I guess in your case the audio element stays the same (ie is not patched) as you only update the source within.

Maybe setting an id to it using the would work.


Thanks @conradfr, I added <audio controls id={"audio-#{}"}> and it works.

1 Like