From 185af94635e47f14334d6660888b8f474a60301e Mon Sep 17 00:00:00 2001 From: Lee Hanbury Date: Wed, 6 Apr 2022 17:29:29 +0100 Subject: [PATCH] Support Android user agent for YT JS API --- src/lite-yt-embed.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lite-yt-embed.js b/src/lite-yt-embed.js index 4c1f887..cdb9f0c 100644 --- a/src/lite-yt-embed.js +++ b/src/lite-yt-embed.js @@ -59,7 +59,7 @@ class LiteYTEmbed extends HTMLElement { // However Safari and Firefox do not successfully track the user gesture of clicking through the creation/loading of the iframe, // so they don't autoplay automatically. Instead we must load an additional 300KB (ungz) of JS for the YT Player API // TODO: chrome android seems to also need this - this.needsYTApiForAutoplay = navigator.vendor.includes('Apple') || navigator.userAgent.includes('Firefox'); + this.needsYTApiForAutoplay = navigator.vendor.includes('Apple') || ['Firefox', 'Android'].some(userAgent => navigator.userAgent.includes(userAgent)); } // // TODO: Support the the user changing the [videoid] attribute