Skip to content

✨ Bento amp-audio#35342

Merged
dethstrobe merged 128 commits intoampproject:mainfrom
rtCamp:add/amp-audio-bento
Apr 12, 2022
Merged

✨ Bento amp-audio#35342
dethstrobe merged 128 commits intoampproject:mainfrom
rtCamp:add/amp-audio-bento

Conversation

@AnuragVasanwala
Copy link
Copy Markdown
Contributor

@AnuragVasanwala AnuragVasanwala commented Jul 21, 2021

The goal of the PR is to add a Bento amp-audio extension. Although component is working but there are few issues which needs to be resolved.

Checklist

  • Add amp-audio
  • Add types
  • Add type annotations
  • Add test case
  • Add npm: true and wrapper : "bento" to bundles.config.extension.json
  • Update Storybook - AMP and Preact
  • latestVersion precedes options
  • Lint, Prettify new amp-audio

Issues (Resolved)

1. Failing test cases:

image

image

2. In Bento AMP context, due to shadow DOM, <source .../> child are not enumerating into <audio ... /> component, instead <slot ... /> is enumerated:

image

Preact component with loading through sources works ✅:

<Audio
     height="75"
     width="auto"
     controls
   >
     <source
       src="https://storage.googleapis.com/media-session/sintel/snow-fight.mp3"
       type="audio/mpeg"
     />
</Audio>

Bento AMP does not work loading through sources ❌:

<amp-audio
      height="75"
      width="auto"
      layout="fixed-height"
      controls
    >
      <source
        src="https://storage.googleapis.com/media-session/sintel/snow-fight.mp3"
        type="audio/mpeg"
      />
      <div fallback>Your browser doesn’t support HTML5 audio</div>
</amp-audio>

Please provide necessary feedback 💡

@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Jul 21, 2021

This pull request introduces 1 alert when merging 3436362 into 2e38479 - view on LGTM.com

new alerts:

  • 1 for Useless conditional

@caroqliu caroqliu self-requested a review July 26, 2021 15:35
Copy link
Copy Markdown
Contributor

@caroqliu caroqliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! Sending first pass now helps get sources working in the AMP layer with some additional recommendations. I'll take a look at tests momentarily.

Copy link
Copy Markdown
Contributor

@caroqliu caroqliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing comments added ⬇️

AnuragVasanwala and others added 12 commits July 28, 2021 12:52
`toggleFallback` can be on `onLoad` / `onError` / etc. instead. The Preact layer does not care what logic is passed here, only when it should be called.

Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com>
Added support to load audio from multiple `<source>` tags.

Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com>
Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com>
`useRef` should be initialised with `null`.

Co-authored-by: Caroline Liu <10456171+caroqliu@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@honeybadgerdontcare honeybadgerdontcare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nit and a question regarding lock files, otherwise lgtm for validation

Running `amp validator --update_tests` have updated `package-lock.json` files.

Co-Authored-By: honeybadgerdontcare <1340565+honeybadgerdontcare@users.noreply.github.com>
@AnuragVasanwala
Copy link
Copy Markdown
Contributor Author

Hi @alanorozco & @jridgewell 👋🏻

Would you please review this PR and provide necessary feedback.

@dethstrobe dethstrobe enabled auto-merge (squash) April 12, 2022 15:18
auto-merge was automatically disabled April 12, 2022 15:47

Head branch was pushed to by a user without write access

@dethstrobe dethstrobe enabled auto-merge (squash) April 12, 2022 16:09
auto-merge was automatically disabled April 12, 2022 16:15

Head branch was pushed to by a user without write access

@dethstrobe dethstrobe enabled auto-merge (squash) April 12, 2022 16:27
@dethstrobe dethstrobe merged commit 8ae5d1a into ampproject:main Apr 12, 2022
banaag pushed a commit to banaag/amphtml that referenced this pull request Apr 19, 2022
@banaag banaag mentioned this pull request Apr 19, 2022
banaag added a commit that referenced this pull request Apr 19, 2022
* cl/441530960 Two-way sync for PR #35342. No-op, or fixes merge conflicts, if any.

* Fix incorrect merge

Co-authored-by: Devin Mullins <twifkak@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.