How do videos autoplay on iOS at youtube.com

28,536

It seems that Youtube's team uses the interaction of the user when taps/clicks a video button to authorize the reproduction.

Remember that youtube.com is a SPA (Single Page Application) so there is no page reload or redirection.

So, youtube.com doesn't have autoplay enabled.

Share:
28,536
vsky
Author by

vsky

Updated on February 18, 2020

Comments

  • vsky
    vsky about 4 years

    When I set autoplay to true for a YouTube video (IFrame API) on my site, it doesn't work. All the documentation says apple disables autoplay on ios for bandwidth reasons.

    However, I see that videos play automatically (without clicking on the video element) on youtube.com on iPad. How did YouTube make it work? It would be hard to imagine Apple does something special just for YouTube.

  • mpobrien
    mpobrien over 9 years
    This doesn't answer the question, and it's not a duplicate. The OP is asking why autoplay does appear to work if you visit the youtube.com homepage on iOS (it does for me, too).
  • Nicolas Miari
    Nicolas Miari over 8 years
    So, they're manipulating the DOM and the URL to make it appear as if you are moving between different pages?
  • Aitor Aznar Álvarez
    Aitor Aznar Álvarez over 8 years
    Yes, with plain javascript and managing navigation with "history pushState". Checkout this for more info about autoplay: stackoverflow.com/questions/29894406/…
  • Jay
    Jay over 8 years
    Tested this and it does not work in Safari on iOS 9.1 and Chrome on iOS 9.1 See the answer by Aitor Aznar Álvarez on how YouTube does it on their mobile version.
  • Bas van Stein
    Bas van Stein over 8 years
    I seriously hate ios 9.1.. thank you for the comment, at the moment of writing ios still worked but that was before this "downgrade".
  • mjwunderlich
    mjwunderlich about 7 years
    This works on a laptop / desktop browser. Does not work on mobile iOS browser. May or may not work on Android.
  • Aitor Aznar Álvarez
    Aitor Aznar Álvarez about 4 years
    The rules about autoplay has changed, especially in Chrome. Take into account this developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide and this developers.google.com/web/updates/2017/09/…