Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

videoLoaded never gets set to true in some instances when video is cached #36

Closed
jonjahr opened this issue Sep 15, 2020 · 2 comments
Closed

Comments

@jonjahr
Copy link
Contributor

jonjahr commented Sep 15, 2020

In some instances, the videoLoaded boolean never gets set to true. When I tested this, I found out that it's because the video element's canplaythrough event never fired. I think this is because the video was cached, and the video element triggered the canplaythrough event so quickly, it fired before Vue could register the event handler. One solution I found is to check the video readyState when the component mounts:

@videoLoaded = true if @$refs?.video?.readyState > 3

Here's a stack overflow that talks about this.

Annoyingly, I can't reproduce this on Netlify, or even in vue-visual Storybook. I can only reproduce this when I run my Nuxt stack on localhost. Maybe Nuxt slows down the mounting/hydration (only in dev mode) just enough for visual to miss the canplaythrough event? I don't know.

I'll send a pull request with the fix in a sec.

@weotch
Copy link
Member

weotch commented Sep 15, 2020

Closed by #37

@weotch weotch closed this as completed Sep 15, 2020
@weotch
Copy link
Member

weotch commented Sep 15, 2020

This is available in 2.3.0 now @jonjahr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants