mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Catch thrown error for autoplay in Safari (#7921)

authored by

Eric Bailey and committed by
GitHub
fd8ac1da beb0fce5

+10 -2
+10 -2
src/view/com/util/post-embeds/VideoEmbedInner/web-controls/utils.tsx
··· 68 68 setError(true) 69 69 } 70 70 71 - const handleCanPlay = () => { 71 + const handleCanPlay = async () => { 72 72 if (bufferingTimeout) clearTimeout(bufferingTimeout) 73 73 setBuffering(false) 74 74 setCanPlay(true) 75 75 76 76 if (!ref.current) return 77 77 if (playWhenReadyRef.current) { 78 - ref.current.play() 78 + try { 79 + await ref.current.play() 80 + } catch (e: any) { 81 + if ( 82 + !e.message?.includes(`The request is not allowed by the user agent`) 83 + ) { 84 + throw e 85 + } 86 + } 79 87 playWhenReadyRef.current = false 80 88 } 81 89 }