about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-12-07 17:10:13 +0000
committerGitHub <noreply@github.com>2024-12-07 17:10:13 +0000
commitea6ac2568433ac86d89195cbc61e54e03e6a6665 (patch)
tree90f236dc88383b80c62923650bee06299d67a2e4 /src
parent296aab4736e09097ec07ff0b9e5f2ac78e342047 (diff)
downloadvoidsky-ea6ac2568433ac86d89195cbc61e54e03e6a6665.tar.zst
Revert "[Video] Revert safari hackfix (#5367)" (#7001)
This reverts commit 94e7bfbe40ba6766361caaba99feff74a187613a.
Diffstat (limited to 'src')
-rw-r--r--src/view/com/util/post-embeds/VideoEmbedInner/web-controls/utils.tsx7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/view/com/util/post-embeds/VideoEmbedInner/web-controls/utils.tsx b/src/view/com/util/post-embeds/VideoEmbedInner/web-controls/utils.tsx
index f5d90b5f7..8aa2d3f7d 100644
--- a/src/view/com/util/post-embeds/VideoEmbedInner/web-controls/utils.tsx
+++ b/src/view/com/util/post-embeds/VideoEmbedInner/web-controls/utils.tsx
@@ -1,5 +1,6 @@
 import React, {useCallback, useEffect, useRef, useState} from 'react'
 
+import {isSafari} from '#/lib/browser'
 import {useVideoVolumeState} from '../../VideoVolumeContext'
 
 export function useVideoElement(ref: React.RefObject<HTMLVideoElement>) {
@@ -37,6 +38,12 @@ export function useVideoElement(ref: React.RefObject<HTMLVideoElement>) {
     const handleTimeUpdate = () => {
       if (!ref.current) return
       setCurrentTime(round(ref.current.currentTime) || 0)
+      // HACK: Safari randomly fires `stalled` events when changing between segments
+      // let's just clear the buffering state if the video is still progressing -sfn
+      if (isSafari) {
+        if (bufferingTimeout) clearTimeout(bufferingTimeout)
+        setBuffering(false)
+      }
     }
 
     const handleDurationChange = () => {