Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Hiding Nav Bar #4055

Closed
BilalHadid opened this issue Aug 5, 2024 · 7 comments · Fixed by #4142
Closed

Feature: Hiding Nav Bar #4055

BilalHadid opened this issue Aug 5, 2024 · 7 comments · Fixed by #4142
Labels
discussion feature not an issue Issue is not linked to react-native-video itself

Comments

@BilalHadid
Copy link

Version

6.4.3

What platforms are you having the problem on?

Android

System Version

Android

On what device are you experiencing the issue?

Real device, Simulator

Architecture

Old architecture

What happened?

When the full-screen view is activated, the default controls are shown, and the mobile bottom navigation bar remains visible, even in full-screen mode. To address this issue, consider upgrading the FullScreenPlayerView found under com => brentvatne => exoplayer.

Code Implementation
To enable immersive mode and hide the navigation bar, override the onAttachedToWindow method:

override fun onAttachedToWindow() {
super.onAttachedToWindow()
// Enable immersive mode to hide the navigation bar
window.decorView.systemUiVisibility = (
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
or View.SYSTEM_UI_FLAG_FULLSCREEN
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
)

if (reactExoplayerView.preventsDisplaySleepDuringVideoPlayback) {
    mKeepScreenOnHandler.post(mKeepScreenOnUpdater)
}

}

Resetting UI Visibility
To reset the UI visibility to default, override the onDetachedFromWindow method:

override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
// Reset UI visibility to default
window.decorView.systemUiVisibility = (
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
)
}

Reproduction

repository link

Reproduction

Step to reproduce this bug are: When the full-screen view is activated

@BilalHadid BilalHadid added the bug label Aug 5, 2024
@seyedmostafahasani
Copy link
Collaborator

@BilalHadid I don’t think this issue is a bug. Also, I think it’s better to keep the navigation bar visible so users can access functionalities like the back button, minimize, and other features available through the navigation bar.
WDYT? @freeboub @KrzysztofMoch

@freeboub
Copy link
Collaborator

freeboub commented Aug 6, 2024

This is a design choice... RNV should give the flexibility to users (i mean the app) to decide!
So you are both right :)

@seyedmostafahasani
Copy link
Collaborator

@freeboub
We can remove the bug label from this issue. I can add a new prop to handle it. What is your opinion?

@KrzysztofMoch KrzysztofMoch added discussion not an issue Issue is not linked to react-native-video itself feature and removed bug labels Aug 6, 2024
@KrzysztofMoch KrzysztofMoch changed the title [BUG]: Feature: Hiding Nav Bar Aug 6, 2024
@BilalHadid
Copy link
Author

@seyedmostafahasani @freeboub Thanks, everyone! Could you please check one more thing? When we set fullScreen={true}, the default controls should be hidden. Even though I used the controls prop and set it to false, the default controls are still appearing. Could you look into this?

@seyedmostafahasani
Copy link
Collaborator

@BilalHadid, you cannot show custom controllers in full-screen mode. You can only display them in normal mode because the controls for full-screen mode are handled on the native side.

I have a suggestion for implementing a custom controller layout in full-screen mode. Instead of using the setFullScreen or other methods when the user presses the full-screen button, you can handle full-screen on the JS side. Specifically, you can create a new screen, and upon pressing the full-screen button, you can navigate to this new screen. This way, you can have your custom controller in full-screen mode.

@JerakRus
Copy link

JerakRus commented Aug 7, 2024

I noticed that if you use fullscreen={true} on Android, the status bar becomes black and does not return to its original color after closing the video. This looks like a mistake

@seyedmostafahasani
Copy link
Collaborator

I noticed that if you use fullscreen={true} on Android, the status bar becomes black and does not return to its original color after closing the video. This looks like a mistake

It will be fixed in this PR(3914).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion feature not an issue Issue is not linked to react-native-video itself
Projects
None yet
5 participants