about summary refs log tree commit diff
path: root/src/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2024-08-09 02:33:42 +0100
committerGitHub <noreply@github.com>2024-08-09 02:33:42 +0100
commit4350dbc853766dc4ba7cc304b7a12505ef0c4781 (patch)
tree4a53a445f0b9972858f3a6cdc84992ed3914aec4 /src/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx
parente782db33dcd415bf6ad122daedd3abd3aafabd64 (diff)
downloadvoidsky-4350dbc853766dc4ba7cc304b7a12505ef0c4781.tar.zst
[Video] Bundle of minor tweaks (#4904)
* fix bg color

* unique video urls for debug

* improve controls slightly

* mute until fullscreen

---------

Co-authored-by: Samuel Newman <10959775+mozzius@users.noreply.github.com>
Diffstat (limited to 'src/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx')
-rw-r--r--src/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx55
1 files changed, 29 insertions, 26 deletions
diff --git a/src/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx b/src/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx
index cc356fb06..b95b9c809 100644
--- a/src/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx
+++ b/src/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx
@@ -1,5 +1,6 @@
 import React, {useEffect, useRef, useState} from 'react'
 import {Pressable, View} from 'react-native'
+import Animated, {FadeIn} from 'react-native-reanimated'
 import {VideoPlayer, VideoView} from 'expo-video'
 
 import {useVideoPlayer} from 'view/com/util/post-embeds/VideoPlayerContext'
@@ -20,7 +21,10 @@ export function VideoEmbedInnerNative() {
       />
       <Controls
         player={player}
-        enterFullscreen={() => ref.current?.enterFullscreen()}
+        enterFullscreen={() => {
+          player.muted = false
+          ref.current?.enterFullscreen()
+        }}
       />
     </View>
   )
@@ -56,34 +60,33 @@ function Controls({
     }
   }, [player])
 
-  if (isNaN(timeRemaining)) {
-    return null
-  }
-
   return (
     <View style={[a.absolute, a.inset_0]}>
-      <View
-        style={[
-          {
-            backgroundColor: 'rgba(0, 0, 0, 0.75',
-            borderRadius: 6,
-            paddingHorizontal: 6,
-            paddingVertical: 3,
-            position: 'absolute',
-            left: 5,
-            bottom: 5,
-          },
-        ]}
-        pointerEvents="none">
-        <Text
+      {!isNaN(timeRemaining) && (
+        <Animated.View
+          entering={FadeIn.duration(100)}
           style={[
-            {color: 'white', fontSize: 12},
-            a.font_bold,
-            android({lineHeight: 1.25}),
-          ]}>
-          {minutes}:{seconds}
-        </Text>
-      </View>
+            {
+              backgroundColor: 'rgba(0, 0, 0, 0.75)',
+              borderRadius: 6,
+              paddingHorizontal: 6,
+              paddingVertical: 3,
+              position: 'absolute',
+              left: 5,
+              bottom: 5,
+            },
+          ]}
+          pointerEvents="none">
+          <Text
+            style={[
+              {color: 'white', fontSize: 12},
+              a.font_bold,
+              android({lineHeight: 1.25}),
+            ]}>
+            {minutes}:{seconds}
+          </Text>
+        </Animated.View>
+      )}
       <Pressable
         onPress={enterFullscreen}
         style={a.flex_1}