TheWidlarzGroup / react-native-video

A <Video /> component for react-native
http://thewidlarzgroup.github.io/react-native-video/
MIT License
7.14k stars 2.88k forks source link

[Feature]: Ability to show/hide any notification control #3822

Open amitmehtacode opened 3 months ago

amitmehtacode commented 3 months ago

Description

want an option to hide or show the controls in a React Native video music control.

Why it is needed ?

want an option to hide or show specific controls in a React Native video music control, as in some cases you may not want a particular control to be visible.

Possible implementation

Technical POV how to do it

Code sample

Code sample

freeboub commented 3 months ago

@amitmehtacode If you want to enhance the behavior, you should improve controlsStyles property

amitmehtacode commented 3 months ago

@freeboub But how can I hide forward and backward icon on version 6.0.0 as controlsStyles are not supported in 6.0.0 version

freeboub commented 3 months ago

no

amitmehtacode commented 3 months ago

@freeboub also checked on version 6.1.1 after adding

controlsStyles={{
          hideSeekBar: true
        }}

The seekBar is still not hidden.

freeboub commented 3 months ago

@freeboub also checked on version 6.1.1 after adding

controlsStyles={{
          hideSeekBar: true
        }}

The seekBar is still not hidden.

Just retested in sample app, it works fine 🤔

amitmehtacode commented 3 months ago

@freeboub please find the recording version: 6.1.1

https://github.com/TheWidlarzGroup/react-native-video/assets/90309641/8937d9af-418a-4050-a875-83ce723a8c87

amitmehtacode commented 3 months ago

@freeboub how can I remove the forward and backward icons? I only want the play and pause icons in it.

YangJonghun commented 3 months ago

@amitmehtacode The showNotificationControls prop enables the Android media session. I'm not sure why you want to disable the backward and forward buttons, but if you want to block functionality, you should remove the listener rather than blocking the UI, because the media session controls all external controls together, including the physical buttons, not just notifications.

amitmehtacode commented 3 months ago

@YangJonghun In one of my use case I only want to show play and pause icon. Also I highly appreciated if you can guide me for the same with code how do I remove the listener. Also if it is possible to hide the icon ?

YangJonghun commented 3 months ago

@amitmehtacode https://github.com/TheWidlarzGroup/react-native-video/blob/master/android/src/main/java/com/brentvatne/exoplayer/VideoPlaybackService.kt https://github.com/TheWidlarzGroup/react-native-video/blob/master/android/src/main/java/com/brentvatne/exoplayer/VideoPlaybackCallback.kt

you need to patch above codes for build media session without predefined buttons(and callbacks)

seyedmostafahasani commented 3 months ago

@freeboub also checked on version 6.1.1 after adding

controlsStyles={{
          hideSeekBar: true
        }}

The seekBar is still not hidden.

Just retested in sample app, it works fine 🤔

@freeboub hideSeekBar just works on video play controller. I think he wants to hide it on notification.

amitmehtacode commented 3 months ago

@freeboub also checked on version 6.1.1 after adding

controlsStyles={{
          hideSeekBar: true
        }}

The seekBar is still not hidden.

Just retested in sample app, it works fine 🤔

@freeboub hideSeekBar just works on video play controller. I think he wants to hide it on notification.

Yes

amitmehtacode commented 3 months ago

@freeboub I want to hide these 3 controls from the notification screen. How can this be done? Additionally, there should be an option to show or remove them through props.

Screenshot_20240528_222257_Chrome

KrzysztofMoch commented 3 months ago

For now there is not prop for doing it - if you need it for commercial project you can contact TheWidlarzGroup here

paulrinaldi commented 3 weeks ago

@amitmehtacode https://github.com/TheWidlarzGroup/react-native-video/blob/0a1085ce03152d58d98da408dbe79e76fa5ebc1a/android/src/main/java/com/brentvatne/exoplayer/VideoPlaybackService.kt#L123 This is where those play and pause icons and functionality are created. This is where you can make some edits and then run the examples/basic with yarn run android.