amphtml
amphtml copied to clipboard
Skip video blessing if autoplaying media with sound is allowed
To work around the fact that web browsers block autoplaying media with sound, we use the click event on the unmute button to unmute + mute back all the media elements, which allows us to autoplay them with sound later on. We call this process "blessing" the media elements. But media operations take time on iOS, and apparently block the main thread for a significant enough amount of time.
However, native webviews can allow autoplaying media with sound. We should try to detect if videos can be autoplayed with sound, and skip the entire expensive blessing process if so.
We should be able to adapt and re-use this piece of code: https://github.com/ampproject/amphtml/blob/9cc61e6bdd1b218aafe65c81dc382f3751797f38/src/utils/video.js#L93-L98
cc @ampproject/wg-stories
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.