Home

Issue: 2391

Video element - cached element

[issue link]

Hi guys I’m a little bit confused about a video element.
My project consist in a main video page. I should be able to play and pause the video to show some extra informations, but when I change route and I come back to the main page, the one with the video, the video gets “duplicated”. You can notice it from the overlayed audio: one from the from the cue point when I paused before changing page, and the other is from the video begin.
It’s like the first element is cached by the browser.

How I can reinit video element when I come back to main page? Or, how can I avoid this “cached video behaviour”?

Video element markup:
<video class="video" playsinline preload="auto" src="~/assets/url/to/video"></video>

Video is stored in a variable in mounted hook like this:
var mainVideo = document.querySelectorAll('.video')[0]

I’ve tried some tricky solutions but i can’t get away with it. Any ideas?

This question is available on Nuxt.js community (#c2077)