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

Suppress errors from autoplay detection play call #6083

Merged
merged 2 commits into from Nov 8, 2016

Conversation

aghassemi
Copy link
Contributor

detectionElement.play();
try {
const playPromise = detectionElement.play();
if (playPromise && playPromise.catch) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there browsers that don't return a promise? As in, they have #play, but not the correct implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh yeah, play has been around as void forever. Only fairly recent versions return a promise (e.g. Chrome 50+). https://developers.google.com/web/updates/2016/03/play-returns-promise

@aghassemi aghassemi merged commit 6c27a1f into ampproject:master Nov 8, 2016
Lith pushed a commit to Lith/amphtml that referenced this pull request Dec 22, 2016
Lith pushed a commit to Lith/amphtml that referenced this pull request Dec 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants