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

how to hide and show next and forward button code snippet #810

Closed
rajam1215 opened this issue Dec 7, 2024 · 9 comments
Closed

how to hide and show next and forward button code snippet #810

rajam1215 opened this issue Dec 7, 2024 · 9 comments
Milestone

Comments

@rajam1215
Copy link

rajam1215 commented Dec 7, 2024

@brianwernick I am working on some project, I show videos in listing, everything is working fine, but need to hide next and forward button

can you explain how i can do this

Thanks

@EugeneAsti
Copy link

Also intresting how to add rewind and fastForward buttons on mobile app?
Thanks

@brianwernick
Copy link
Owner

@rajam1215 You can hide the previous and next buttons with setPreviousButtonRemoved and setNextButtonRemoved if you are using the default VideoControls provided

e.g.

(videoView.videoControls as? DefaultControls)?.let { controls ->
    controls.setPreviousButtonRemoved(true)
    controls.setNextButtonRemoved(true)
}

@brianwernick
Copy link
Owner

@EugeneAsti Similar to the above previous & next button functions, there are functions for setRewindButtonRemoved and setFastForwardButtonRemoved functions; however if you are using the default VideoControls then these won't actually have any affect (they no-op on mobile and tv layouts now).

So you will need to provide your own layout and implementation for the VideoControls which you can provide with a VideoControlsProvider that's passed in via the videoControlsProvider attribute.

If you have more questions around the VideoControlsProvider please open a new issue

@rajam1215
Copy link
Author

rajam1215 commented Dec 11, 2024

@rajam1215 You can hide the previous and next buttons with setPreviousButtonRemoved and setNextButtonRemoved if you are using the default VideoControls provided

e.g.

(videoView.videoControls as? DefaultControls)?.let { controls ->
    controls.setPreviousButtonRemoved(true)
    controls.setNextButtonRemoved(true)
}

@brianwernick in java it is look like this, Is it Ok?

DefaultVideoControls controls =
     (DefaultVideoControls) dataBinding.videoView.getVideoControls();
   if (controls != null) {
    controls.setPreviousButtonRemoved(true);
    controls.setNextButtonRemoved(true);
 }

But with my above code setPreviousButtonRemoved and setNextButtonRemoved not working, Buttons not hide can you elaborate this once

But this functions are working fine

DefaultVideoControls controls =
    (DefaultVideoControls) dataBinding.videoView.getVideoControls();
    if (controls != null) {
        controls.setPreviousButtonEnabled(false);
        controls.setNextButtonEnabled(false);
    }

@brianwernick
Copy link
Owner

Ah, I see. There's a bug that was likely introduced when we re-wrote the controls for 5.0 where the "remove" request isn't retained through media load states. Specifically the visibility updates in onLoadEnded will always set the next/previous buttons as visible.

@rajam1215
Copy link
Author

@brianwernick when new version will live 5.2.0, so I will get new changes in my code

@brianwernick
Copy link
Owner

There are a few other things that I'm going to look into updating/fixing; but I'm tentatively planning on releasing the update later this week

@rajam1215
Copy link
Author

@brianwernick I waiting for this thanks

@brianwernick
Copy link
Owner

5.2.0 has been released

@brianwernick brianwernick added this to the 5.2.0 milestone Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants