mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 21:23:45 +01:00
Merge pull request #27031 from overleaf/rh-safari-video-el
Catch video autoplay errors from Safari GitOrigin-RevId: c2ed2b0a720603bfb80ebb3025c4ed107eec7f06
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import { debugConsole } from '@/utils/debugging'
|
||||||
|
|
||||||
function setup(videoEl) {
|
function setup(videoEl) {
|
||||||
const reducedMotionReduce = window.matchMedia(
|
const reducedMotionReduce = window.matchMedia(
|
||||||
'(prefers-reduced-motion: reduce)'
|
'(prefers-reduced-motion: reduce)'
|
||||||
@@ -35,10 +37,18 @@ function setup(videoEl) {
|
|||||||
videoIsVisible = true
|
videoIsVisible = true
|
||||||
if (videoEl.readyState >= videoEl.HAVE_FUTURE_DATA) {
|
if (videoEl.readyState >= videoEl.HAVE_FUTURE_DATA) {
|
||||||
if (!videoEl.ended) {
|
if (!videoEl.ended) {
|
||||||
videoEl.play()
|
videoEl
|
||||||
|
.play()
|
||||||
|
.catch(error =>
|
||||||
|
debugConsole.error('Video autoplay failed:', error)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
videoEl
|
||||||
|
.play()
|
||||||
|
.catch(error =>
|
||||||
|
debugConsole.error('Video autoplay failed:', error)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
videoEl.play()
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
videoIsVisible = false
|
videoIsVisible = false
|
||||||
|
|||||||
Reference in New Issue
Block a user