extensions/amp-story/1.0/amp-story.js
/**
   * Handles a background-audio attribute set on an <amp-story> tag.
   * @private
   */
Handles a background-audio attribute set on an  tag.
@private
Handles a background - audio attribute set on an tag . @private
registerAndPreloadBackgroundAudio_() {
    let backgroundAudioEl = upgradeBackgroundAudio(this.element);
    if (!backgroundAudioEl) {
      return;
    }
    this.activePage_.element
      .signals()
      .whenSignal(CommonSignals_Enum.LOAD_END)
      .then(() => {
        backgroundAudioEl =  (
          backgroundAudioEl
        );
        this.mediaPool_.register(backgroundAudioEl);
        return this.mediaPool_.preload(backgroundAudioEl);
      })
      .then(() => {
        this.backgroundAudioEl_ =  (
          childElement(this.element, (el) => {
            return el.tagName.toLowerCase() === 'audio';
          })
        );
      });
  }
registerAndPreloadBackgroundAudio_ ( ) { let backgroundAudioEl = upgradeBackgroundAudio ( this . element ) ; if ( ! backgroundAudioEl ) { return ; } this . activePage_ . element . signals ( ) . whenSignal ( CommonSignals_Enum . LOAD_END ) . then ( ( ) => { backgroundAudioEl = ( backgroundAudioEl ) ; this . mediaPool_ . register ( backgroundAudioEl ) ; return this . mediaPool_ . preload ( backgroundAudioEl ) ; } ) . then ( ( ) => { this . backgroundAudioEl_ = ( childElement ( this . element , ( el ) => { return el . tagName . toLowerCase ( ) === 'audio' ; } ) ) ; } ) ; }
Handles a background-audio attribute set on an <amp-story> tag.
Handles a background - audio attribute set on an <amp - story > tag .
// Once the media pool is ready, registers and preloads the background // audio, and then gets the swapped element from the DOM to mute/unmute/play // it programmatically later. /** @type {!HTMLMediaElement} */ /** @type {!HTMLMediaElement} */