[Video] Toggle controls when entering fullscreen (#5113)
parent
5d300bec90
commit
7f26ad508e
|
@ -26,6 +26,7 @@ export function VideoEmbedInnerNative({
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {player} = useActiveVideoNative()
|
const {player} = useActiveVideoNative()
|
||||||
const ref = useRef<VideoView>(null)
|
const ref = useRef<VideoView>(null)
|
||||||
|
const [isFullscreen, setIsFullscreen] = useState(false)
|
||||||
|
|
||||||
const enterFullscreen = useCallback(() => {
|
const enterFullscreen = useCallback(() => {
|
||||||
ref.current?.enterFullscreen()
|
ref.current?.enterFullscreen()
|
||||||
|
@ -46,12 +47,13 @@ export function VideoEmbedInnerNative({
|
||||||
player={player}
|
player={player}
|
||||||
style={[a.flex_1, a.rounded_sm]}
|
style={[a.flex_1, a.rounded_sm]}
|
||||||
contentFit="contain"
|
contentFit="contain"
|
||||||
nativeControls={false}
|
nativeControls={isFullscreen}
|
||||||
accessibilityIgnoresInvertColors
|
accessibilityIgnoresInvertColors
|
||||||
onEnterFullscreen={() => {
|
onEnterFullscreen={() => {
|
||||||
PlatformInfo.setAudioCategory(AudioCategory.Playback)
|
PlatformInfo.setAudioCategory(AudioCategory.Playback)
|
||||||
PlatformInfo.setAudioActive(true)
|
PlatformInfo.setAudioActive(true)
|
||||||
player.muted = false
|
player.muted = false
|
||||||
|
setIsFullscreen(true)
|
||||||
}}
|
}}
|
||||||
onExitFullscreen={() => {
|
onExitFullscreen={() => {
|
||||||
PlatformInfo.setAudioCategory(AudioCategory.Ambient)
|
PlatformInfo.setAudioCategory(AudioCategory.Ambient)
|
||||||
|
@ -60,6 +62,7 @@ export function VideoEmbedInnerNative({
|
||||||
if (!player.playing) {
|
if (!player.playing) {
|
||||||
player.play()
|
player.play()
|
||||||
}
|
}
|
||||||
|
setIsFullscreen(false)
|
||||||
}}
|
}}
|
||||||
accessibilityLabel={
|
accessibilityLabel={
|
||||||
embed.alt ? _(msg`Video: ${embed.alt}`) : _(msg`Video`)
|
embed.alt ? _(msg`Video: ${embed.alt}`) : _(msg`Video`)
|
||||||
|
|
Loading…
Reference in New Issue