Hey all! I’m working on a little side-project, and am having an absolute blast tinkering with Hotwire.
I’ve run into a small snag I can’t seem to figure out. I have a video tag on a page. When I visit that page, the video doesn’t load—nada. If I refresh the page, it’s there just fine. Click away, and back, and it’s gone again.
If I add a
data-turbo-permanent attribute to the video tag the behavior is slightly different. If I navigate to the page with the video, it still doesn’t work. But if I then navigate away, and back to the video page, it loads! And similarly, if I refresh on the video page, it sticks around correctly when I navigate away and back.
I’ve read up a bit on the HTMLMediaElement apis, but can’t seem to figure out what’s going on.
Here’s a gif demo showing the case without data-turbo-permanent:
Notice when I navigate back to the video page, there’s a quick flash of the video, where it looks like the cached
preview that’s shown has the video loaded, and is quickly replaced with an unready one with the response from the server.
Any ideas about what’s going on?