Skip to content

Commit

Permalink
[Video] Toggle controls when entering fullscreen (#5113)
Browse files Browse the repository at this point in the history
  • Loading branch information
haileyok authored Sep 3, 2024
1 parent 5d300be commit 7f26ad5
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export function VideoEmbedInnerNative({
const {_} = useLingui()
const {player} = useActiveVideoNative()
const ref = useRef<VideoView>(null)
const [isFullscreen, setIsFullscreen] = useState(false)

const enterFullscreen = useCallback(() => {
ref.current?.enterFullscreen()
Expand All @@ -46,12 +47,13 @@ export function VideoEmbedInnerNative({
player={player}
style={[a.flex_1, a.rounded_sm]}
contentFit="contain"
nativeControls={false}
nativeControls={isFullscreen}
accessibilityIgnoresInvertColors
onEnterFullscreen={() => {
PlatformInfo.setAudioCategory(AudioCategory.Playback)
PlatformInfo.setAudioActive(true)
player.muted = false
setIsFullscreen(true)
}}
onExitFullscreen={() => {
PlatformInfo.setAudioCategory(AudioCategory.Ambient)
Expand All @@ -60,6 +62,7 @@ export function VideoEmbedInnerNative({
if (!player.playing) {
player.play()
}
setIsFullscreen(false)
}}
accessibilityLabel={
embed.alt ? _(msg`Video: ${embed.alt}`) : _(msg`Video`)
Expand Down

0 comments on commit 7f26ad5

Please sign in to comment.