Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

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

Ignore common video errors (#8548)

authored by

Samuel Newman and committed by
GitHub
92ee6260 9c7b330f

+16 -3
+16 -3
src/components/Post/Embed/VideoEmbed/VideoEmbedInner/web-controls/utils.tsx
··· 1 1 import {type RefObject, useCallback, useEffect, useRef, useState} from 'react' 2 2 3 3 import {isSafari} from '#/lib/browser' 4 + import {logger} from '#/logger' 4 5 import {useVideoVolumeState} from '#/components/Post/Embed/VideoEmbed/VideoVolumeContext' 5 6 6 7 export function useVideoElement(ref: RefObject<HTMLVideoElement>) { ··· 79 80 await ref.current.play() 80 81 } catch (e: any) { 81 82 if ( 82 - !e.message?.includes(`The request is not allowed by the user agent`) 83 + !e.message?.includes( 84 + `The request is not allowed by the user agent`, 85 + ) && 86 + !e.message?.includes( 87 + `The play() request was interrupted by a call to pause()`, 88 + ) 83 89 ) { 84 90 throw e 85 91 } ··· 176 182 } else { 177 183 const promise = ref.current.play() 178 184 if (promise !== undefined) { 179 - promise.catch(err => { 180 - console.error('Error playing video:', err) 185 + promise.catch((err: any) => { 186 + if ( 187 + // ignore this common error. it's fine 188 + !err.message?.includes( 189 + `The play() request was interrupted by a call to pause()`, 190 + ) 191 + ) { 192 + logger.error('Error playing video:', {message: err}) 193 + } 181 194 }) 182 195 } 183 196 }