Skip to content

[Story mediapool] Reused videos with gain node stay muted after reuse #38206

@mszylkowski

Description

@mszylkowski

Description

When the mediapool changes the volume of a video, it connects a gainNode to createMediaElementSource to distort the audio coming from the video. However, the gainNode and MediaElementSource need to be removed from the video before it's reused by another amp-video. Currently, reusing the mediapool video element will keep it silent.

Eg: a story with 8 pages that have noaudio videos (that are muted) will initialize 8 mediapool videos that are all muted. All videos on pages 9+ will be muted because they reuse the same sources, and they were never unmuted.

Reproduction Steps

Go to https://stories.nws.ai/1288496525/what-makes-content-good-copy-only-mp4-2/ and unmute the story, then advance until the 3rd to last video shows up (page with Andrew Robertson) and it will not be audible. The error MediaElementAudioSource outputs zeroes due to CORS access restrictions for <video URL> is thrown on the console.

Relevant Logs

MediaElementAudioSource outputs zeroes due to CORS access restrictions for <video URL>

I don't believe CORS is the cause of muting because the unmuted videos shouldn't have the createMediaElementSource at all. This error could make videos with volume=x mute when in cross origin. Also when reloading the page, those videos play properly. However, MediaElementAudioSource should not process the audio from videos with audio (and no volume attr)

Browser(s) Affected

Chrome

OS(s) Affected

Mac, others?

Device(s) Affected

Macbook, others?

AMP Version Affected

latest

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions