From 4350dbc853766dc4ba7cc304b7a12505ef0c4781 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 9 Aug 2024 02:33:42 +0100 Subject: [PATCH] [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> --- src/view/com/posts/FeedItem.tsx | 20 +++++-- .../VideoEmbedInner/VideoEmbedInnerNative.tsx | 55 ++++++++++--------- .../util/post-embeds/VideoPlayerContext.tsx | 1 + 3 files changed, 45 insertions(+), 31 deletions(-) diff --git a/src/view/com/posts/FeedItem.tsx b/src/view/com/posts/FeedItem.tsx index 8592f0be..0071e240 100644 --- a/src/view/com/posts/FeedItem.tsx +++ b/src/view/com/posts/FeedItem.tsx @@ -1,4 +1,4 @@ -import React, {memo, useMemo, useState} from 'react' +import React, {memo, useId, useMemo, useState} from 'react' import {StyleSheet, View} from 'react-native' import { AppBskyActorDefs, @@ -137,7 +137,6 @@ let FeedItemInner = ({ const {openComposer} = useComposerControls() const pal = usePalette('default') const {_} = useLingui() - const gate = useGate() const href = useMemo(() => { const urip = new AtUri(post.uri) @@ -356,9 +355,7 @@ let FeedItemInner = ({ postAuthor={post.author} onOpenEmbed={onOpenEmbed} /> - {gate('video_debug') && ( - - )} + + ) +} + const styles = StyleSheet.create({ outer: { paddingLeft: 10, diff --git a/src/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx b/src/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative.tsx index cc356fb0..b95b9c80 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() { /> ref.current?.enterFullscreen()} + enterFullscreen={() => { + player.muted = false + ref.current?.enterFullscreen() + }} /> ) @@ -56,34 +60,33 @@ function Controls({ } }, [player]) - if (isNaN(timeRemaining)) { - return null - } - return ( - - - {minutes}:{seconds} - - + { + backgroundColor: 'rgba(0, 0, 0, 0.75)', + borderRadius: 6, + paddingHorizontal: 6, + paddingVertical: 3, + position: 'absolute', + left: 5, + bottom: 5, + }, + ]} + pointerEvents="none"> + + {minutes}:{seconds} + + + )} { player.loop = true + player.muted = true player.play() })