vlitejs / vlite

🦋 vLitejs is a fast and lightweight Javascript library for customizing video and audio player in Javascript with a minimalist theme (HTML5, Youtube, Vimeo, Dailymotion)
https://vlite.js.org
MIT License
266 stars 18 forks source link

If video element has preload='none' - player shows loading indicator and video play cannot be started #116

Closed ignl closed 6 months ago

ignl commented 8 months ago

If the feature request is for a plugin or provider, specify it here.

Html5Provider

If the feature solves a problem you have, specify it here.

preload="none" doesn't work.

Describe the proposed feature.

It seems waitUntilVideoIsReady function relies on browser events loadedmetadata and canplay. If preload="none" those events are not emitted and player stays in loading state. I could not find easy way to solve this without changing the code, maybe I am missing something. In general I think play button should be always initially shown (never loading). So if user scrolls multiple videos he doesn't even see changes between loading indicator and play button. If he clicks play button but video is not ready yet, then loading indicator should be shown until browser sends the events that video is ready. Changing it to this way would solve preload='none' issue with maybe other similar issues and would improve UX.

Describe alternatives you've considered

No response

Additional context

No response

Related issues

No response

yoriiis commented 8 months ago

Thanks @ignl for the report. That's interesting, maybe the preload management can simply be removed. I tested and it seems to work.

Can you look at the changes and test on your side too (#118)?

ignl commented 8 months ago

Yes it works for me, thanks for prompt response!