Hello, after Chrome last update, my code doesn't work anymore. Video is flickering on scroll. I activated controls on video to check the correct animation of GSAP and all seems to be good but video doesn't follow scroll correctly and needs seconds to align with the scroll position. Video is encoded correctly and since 5/6 day ago, it worked correctly an all devices and browsers. On Safari, for example, it works correctly.
It seems that the problem is related to Chrome on Mac.
Does anyone have a suggestion? Thanks so much.
Here's the code to play video on scrub.
//GESTISCO IL PLAY/PAUSE DEL VIDEO SECONDO LO SCROLL
let video = document.querySelector('#thevideo');
let sections = document.querySelectorAll('.gsap--section');
/* Make sure the video is 'activated' on iOS */
function once(el, event, fn, opts) {
var onceFn = function (e) {
el.removeEventListener(event, onceFn);
fn.apply(this, arguments);
};
el.addEventListener(event, onceFn, opts);
return onceFn;
}
video.play(); // must call .play() first, otherwise it won't trigger things to be scrubbable (weird)
video.pause();
var containerH = $(".gsap--outer").outerHeight();
//TIMELINE
const videoTl = gsap.timeline({
scrollTrigger: {
scroller: '.inner-site',
pinType: 'fixed',
anticipatePin: 1,
trigger: ".gsap-pincontainer",
start: "top top",
end: "+=" + (100 * sections.length) + "%",
pin: true,
scrub: 2,
// markers: true,
}
});
videoTl.to( video, {
currentTime: 14,
});
videoTl.to(".gsap--outer", {
y: -(containerH - innerHeight), //100% - altezza del col-span
}, "<");
}