Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebTorrent: Wait for media metadata before attempting autoplay #3052

Merged
merged 1 commit into from
Jul 31, 2019

Conversation

feross
Copy link
Contributor

@feross feross commented Jul 31, 2019

Fix: brave/brave-browser#5471

If the media element does not have metadata available immediately when the media viewer loads, then autoplay will fail with a DOMException.

So, we now wait for the metadata to be loaded before calling play().

Submitter Checklist:

Test Plan:

  1. Load the torrent from https://ia802608.us.archive.org/18/items/gd1975-06-17.aud.unknown.87560.flac16/gd1975-06-17.aud.unknown.87560.flac16_archive.torrent
  2. Start the download.
  3. Scroll to the bottom of the file list and select the last MP3 file in the list (file number 111). (This is so that the file data is not likely to be downloaded by webtorrent yet.)
  4. The file should eventually start playing. There should be no warning that autoplay was blocked.

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@feross feross added the feature/webtorrent Label for webtorrent related issues label Jul 31, 2019
@feross feross added this to the 0.70.x - Nightly milestone Jul 31, 2019
@feross feross requested a review from yrliou July 31, 2019 00:17
@feross feross self-assigned this Jul 31, 2019
Fix: brave/brave-browser#5471

If the media element does not have metadata available immediately when the media viewer loads, then autoplay will fail with a `DOMException`.

So, we now wait for the metadata to be loaded before calling `play()`.
@feross feross force-pushed the webtorrent-autoplay2 branch from ea52091 to c646d5d Compare July 31, 2019 00:18
Copy link
Member

@yrliou yrliou left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/webtorrent Label for webtorrent related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WebTorrent: Autoplay is sometimes blocked if media metadata is not ready yet
2 participants