Giter Site home page Giter Site logo

Comments (9)

caiogondim avatar caiogondim commented on June 6, 2024 5

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.

tornqvist avatar tornqvist commented on June 6, 2024 2

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.

AntonTrollback avatar AntonTrollback commented on June 6, 2024 1

Minor note that might save you debugging time: videos never autoplay on iOS with battery saving mode turned on.

from choo.

bcomnes avatar bcomnes commented on June 6, 2024 1

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.

bcomnes avatar bcomnes commented on June 6, 2024 1

IME video reuiqres user input at this point on chrome.

from choo.

goto-bus-stop avatar goto-bus-stop commented on June 6, 2024

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.

istvanvasil avatar istvanvasil commented on June 6, 2024

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.

istvanvasil avatar istvanvasil commented on June 6, 2024

@tornqvist did you encounter anything like this when working on quantifiedplanet.org header video?

from choo.

istvanvasil avatar istvanvasil commented on June 6, 2024

Thank you all for the information and help.

from choo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.