Skip to content

Commit

Permalink
🔥 [Story mediapool] Fix videos from mediapool with noaudio don't ha…
Browse files Browse the repository at this point in the history
…ve audio when reused. (#38216)

* Added tasts

* Undo

* When noaudio, stop using gain nodes

* Update extensions/amp-story/1.0/media-pool.js

Co-authored-by: Gabriel Majoulet <gmajoulet@google.com>

Co-authored-by: Gabriel Majoulet <gmajoulet@google.com>
(cherry picked from commit 83c3690)
  • Loading branch information
mszylkowski authored and alin04 committed May 20, 2022
1 parent 73a4e57 commit 3bd4f16
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions extensions/amp-story/1.0/media-pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -862,13 +862,13 @@ export class MediaPool {
if (mediaType == MediaType_Enum.VIDEO) {
const ampVideoEl = domMediaEl.parentElement;
if (ampVideoEl) {
if (ampVideoEl.hasAttribute('noaudio')) {
this.setVolume_(domMediaEl, 0);
} else {
const volume = ampVideoEl.getAttribute('volume');
if (volume) {
this.setVolume_(domMediaEl, parseFloat(volume));
}
const volume = parseFloat(ampVideoEl.getAttribute('volume'));
const isMuted = volume <= 0 || ampVideoEl.hasAttribute('noaudio');
if (isMuted) {
return Promise.resolve();
}
if (volume < 1) {
this.setVolume_(domMediaEl, volume);
}
}
}
Expand Down

0 comments on commit 3bd4f16

Please sign in to comment.