amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Improve the Story unmuting experience

Open gmajoulet opened this issue 4 years ago • 2 comments

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.

gmajoulet avatar Apr 14 '20 16:04 gmajoulet

cc @ampproject/wg-stories

gmajoulet avatar Apr 14 '20 16:04 gmajoulet

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.

stale[bot] avatar Oct 01 '22 06:10 stale[bot]