videojs / videojs-contrib-ads

A Tool for Building Video.js Ad Plugins
http://videojs.github.io/videojs-contrib-ads/
Other
384 stars 257 forks source link

fix: Toggle autoplay directly on tech when restoring snapshot for iOS #565

Closed Essk closed 9 months ago

Essk commented 9 months ago

Problem: restorePlayerSnapshot uses autoplay(true) to force a content load in iOS Safari for correct placement of the playhead after an ad break. However if an integration has set normalizeAutoplay: true in the setup of videojs, autoplay() hands off to an async, programatic play request with manualAutoplay('play'). The subsequent seek-back causes a visible restart of the content after ~1 second of playback.

Solution: We can avoid the visual glitch by toggling autoplay directly on the HTML5 tech. The existing followup mechanism to clear out the autoplay status continues to work as expected as autoplay(false) is passed to the tech anyway.