Comments (9)
Hi there. I have to deal with this almost every day on my work.
It's a quite hairy topic, but a TL;DR is:
- Autoplay is not guaranteed anymore
- Every browser uses a different strategy to enable or not autoplay
- There is no native API to detect autoplay
- We created https://github.com/video-dev/can-autoplay lib to detect autoplay. NYT, Vimeo, and others are using in production
- That same lib API is being considered to be ported as a native API whatwg/html#3617 (comment)
from choo.
Like @goto-bus-stop says autoplaying video is a real hassle. In the case of quantified planet we're actually attaching listeners for the canplay
event and trigger play programmatically and switching between a short video and a longer one once loaded. You can check out the source code for the video player is here: https://github.com/codeandconspire/quantifiedplanet.org/blob/master/components/story/video.js
from choo.
Minor note that might save you debugging time: videos never autoplay on iOS with battery saving mode turned on.
from choo.
Sounds like the chrome changes may get reverted: https://games.slashdot.org/story/18/10/16/169242/chrome-70-wont-ship-with-a-patch-for-autoplay-blocking-web-audio-api-which-broke-web-apps-and-games-earlier-this-year
Cool to close this? Its not really a choo specific issue.
from choo.
IME video reuiqres user input at this point on chrome.
from choo.
Chrome really dislikes autoplaying video without interaction. That's probably why it starts working after navigating away and back; you've already interacted with the page, so Chrome allows it to autoplay. (This way you won't get autoplaying videos in popups or tabs you don't actually use, so it kinda makes sense)
My understanding of Chrome's policy though is that muted videos should autoplay fine, so there's probably still something else going on here too!
For reference: https://www.chromium.org/audio-video/autoplay
from choo.
Exactly @goto-bus-stop
I've searched a lot on this and seems like people in Angular had some similar issue as well. I've seen the same video tag execute as intended in Vue. So it seems that it is affected by the framework.
I use browserify
together with yo-yoify
, es2040
and tinyify
to bundle up my project.
from choo.
@tornqvist did you encounter anything like this when working on quantifiedplanet.org header video?
from choo.
Thank you all for the information and help.
from choo.
Related Issues (20)
- Flicker on route change + window scroll in Safari HOT 2
- Redirects do not work HOT 3
- Page freeze in Safari when navigating using trackpad swipe HOT 3
- Is choo abandoned / no longer maintained? HOT 4
- Running Router On a Specific Path with Hash Routing HOT 3
- Could not query selector id with hypen HOT 4
- Magic in the emitter callback? HOT 4
- v7.0.0 HOT 7
- Is it possible to use choojs with es import syntax? HOT 2
- Can I pass a rootNode to `nanohref`? HOT 5
- New feature: Async route support HOT 1
- [domain] ssl-cert expired HOT 6
- Experimenting with custom elements
- Route handler return value HOT 3
- Usage with http-server HOT 1
- What are the precise set of rewrite rules so that if a user specifies app.mount(<PATH>, component) they can retrieve that in the URL?
- Wrong return type for `mount`
- SSL_CTX_use_certificate:ee key too small
- Project abandoned? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from choo.