originalexe / vidim Goto Github PK
View Code? Open in Web Editor NEWBackground videos made easy. Supports both YouTube and self hosted videos.
License: MIT License
Background videos made easy. Supports both YouTube and self hosted videos.
License: MIT License
Hi,
When I go to my site with a youtube video loop It works, but If I leave that window/tab and then come back it doesn't work anymore, it stays with the youtube loading spinner.
On chrome with windows 10.
Windows 10
Chrome
vidim/src/providers/youtube.js
Lines 87 to 88 in 795bcdd
Although it does not seem to be documented in the YouTube Embed API Reference, adding in host: 'https://www.youtube-nocookie.com',
to the outer playerParams
object will tell the API to use the version of YouTube that does not set tracking cookies.
This is especially useful for EU websites that have GDPR concerns.
See https://portalzine.de/dev/api/youtube-iframe-api-and-cookieless-domain-solution-gdpr-dsgvo/
First, I want to say you've done an excellent job with this library. It's easy to setup and I love the fluidity between self-hosted and youtube as options! So, thank you so much for coming up with an elegant solution to this highly popular feature ๐
One thing I noticed however, is that the video seemingly reloads itself FREQUENTLY. It seems to happen often when I leave the page and come back, resize the browser, or simply wait for it to loop. I'm constantly getting the loading spinner, even though the YouTube video has clearly already loaded fully (testing with a 10 sec clip).
Any ideas why this is? It's unusual and not something I see happening with the more basic CSS implementations of YouTube background videos, which leads me to believe it has to do with how you're looping the video or interacting with the API.
It would be perfect if it supports also Vimeo!:)
vidim/src/providers/youtube.js
Line 97 in 38085bd
Although not mentioned in the player parameters documentation (https://developers.google.com/youtube/player_parameters#origin), after reading the documention on the IFrame Player API (https://developers.google.com/youtube/iframe_api_reference), it looks like the origin parameter should include the protocol and port also:
origin: typeof window.location.origin !== 'undefined' ? window.location.origin : window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: ''),
https://developer.mozilla.org/en-US/docs/Web/API/Location/origin says location.origin is not supported in IE/Safari/Opera, however it seems to work in IE11 and Edge from limited testing - the above snippet includes a fallback just in case.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.