From 21e214c23579e5ca45fed3ec563d4010e37562a2 Mon Sep 17 00:00:00 2001
From: Samuel Newman <mozzius@protonmail.com>
Date: Wed, 14 Aug 2024 20:21:14 +0100
Subject: [Video] set audio category to ambient every time a new player is made
 (#4934)

* set auto category to ambient every time a new player is made

* mute on foregrounding

* remember previous state

---------

Co-authored-by: Samuel Newman <10959775+mozzius@users.noreply.github.com>
Co-authored-by: Hailey <me@haileyok.com>
---
 .../com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx     | 3 +++
 1 file changed, 3 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 11fff4796..fa4943876 100644
--- a/src/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx
+++ b/src/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx
@@ -28,6 +28,9 @@ export function VideoEmbedInnerNative() {
   useEffect(() => {
     try {
       if (isAppFocused === 'active' && isScreenFocused && !player.playing) {
+        PlatformInfo.setAudioCategory(AudioCategory.Ambient)
+        PlatformInfo.setAudioActive(false)
+        player.muted = true
         player.play()
       } else if (player.playing) {
         player.pause()
-- 
cgit 1.4.1

