Jump to content
Search Community

ScrollTrigger Video Animation - doesn't work on iOS

EdoRaba test
Moderator Tag

Recommended Posts

I'm using scrollTrigger to animate some videos (.mp4) on scroll.
Everything seemed to work fine, except that it doesn't seem to work on iOS (I tested on iPhone 11 iOS 16.0 and on iPhone 13 iOS 16.2).
In fact, it is as if it didn't load the videos, the space remains empty and obviously the GSAP scrollTrigger animation doesn't start.
Did I miss something?

See the Pen ExeLgOE by edoardo-baravaglio (@edoardo-baravaglio) on CodePen

Link to comment
Share on other sites

This is totally unrelated to GSAP/ScrollTrigger - it looks like iOS requires that you have the playsinline attribute on your <video>...which React strips out unless you define it as playsInline (capital "I"). Same for the autoplay attribute...but since iOS requires autoplay and you don't want it to actually play, you must listen for the loadeddata  event and pause it and strip out the autoplay attribute (annoying!):  

 

See the Pen poOOxEj?editors=1010 by GreenSock (@GreenSock) on CodePen

 

Better? 

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...