From d94ff2695db945b49b88d47c1a3d0b85d8b939e0 Mon Sep 17 00:00:00 2001
From: Hailey <me@haileyok.com>
Date: Wed, 4 Sep 2024 08:06:58 -0700
Subject: [Video] Throw error when playback fails (#5132)

---
 .../util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx   | 9 +++++++++
 1 file changed, 9 insertions(+)

(limited to 'src/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx')

diff --git a/src/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx b/src/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx
index 913fca568..ad844b93d 100644
--- a/src/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx
+++ b/src/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx
@@ -101,9 +101,18 @@ function VideoControls({
         setTimeRemaining(secondsRemaining)
       },
     )
+    const statusSub = player.addListener(
+      'statusChange',
+      (status, _oldStatus, error) => {
+        if (status === 'error') {
+          throw error
+        }
+      },
+    )
     return () => {
       volumeSub.remove()
       timeSub.remove()
+      statusSub.remove()
     }
   }, [player])
 
-- 
cgit 1.4.1

