ampproject / ampproject/amphtml

Improve the Story unmuting experience

Open
#27,747 2 comments 0 reactions 1 assignee Assigned to @gmajoulet View on GitHub
P2: Soon Stale Type: Bug WG: stories
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

Unmuting a story with many videos on iOS has a lag between the user interaction (click) and the result ("Sound on" message + sound actually on).
Example: https://stories.nonblocking.io/waffles/

This lag comes from the fact that we "bless" all the media elements the media pool has. To work around the fact that web browsers block autoplaying media with sound, we use the unmute click event to unmute + mute back all the media elements, which allows us to autoplay them with sound later on. But media operations take time on iOS, and apparently block the main thread for a significant enough amount of time.

We can optimize the order in which things happen to make it look fast:

1. Show the "Sound on" message right away
2. Unmute the media on the currently active page
3. Bless all other media

We need to find a way to delay (3) that still allows us to "bless" the media. If we don't call unmute/mute upon a user gesture, like this click, these operations would be blocked.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.