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

override fun onEnterFullScreen(fullScreenView: View, exitFullScreen: Function0<Unit>) in this method how we can hide MenuButton or their click event is disable from fullscreenview object #1097

Open
GauravMeghanathiWeDoApps opened this issue Dec 28, 2023 · 3 comments
Labels

Comments

@GauravMeghanathiWeDoApps
<!-- 
    youTubePlayerView.addFullScreenListener(object : FullScreenListener {
      override fun onEnterFullScreen(fullScreenView: View, exitFullScreen: Function0<Unit>) {
        // the video will continue playing in fullScreenView
        youTubePlayerView.visibility = View.GONE
        fullScreenViewContainer.visibility = View.VISIBLE
        fullScreenViewContainer.addView(fullScreenView)

        // optionally request landscape orientation
        // requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
      }

      override fun onExitFullScreen() {
        // the video will continue playing in the player
        youTubePlayerView.visibility = View.VISIBLE
        fullScreenViewContainer.visibility = View.GONE
        fullScreenViewContainer.removeAllViews()
      }
    })
-->

# Question / Problem
 override fun onEnterFullScreen(fullScreenView: View, exitFullScreen: Function0<Unit>){}
// here I want to hide Menu button /overflow button  from fullScreenView Object  try to finding their button id it is getting null so any other way to hide during full screen when I was exitFullscreen it hides the button but at first time I can see that button because that button object find out menu button on youtubeplayer view when it is ready so I can hide it. but when I goes to fullscreen then it always show it. can you help me to hide it.

### Summary
<!-- 
I want to hide Menu button always state even if it full screen or not. so first time when YouTube player ready it is hide but when I was going to full screen then it will appear and after I was exit then it will gone. can you guide me to solve this issued because my client want to their YouTube video is not sharing out side the application.
-->

### What I've tried
 
 mBinding.youtubePlayerView.addFullscreenListener(object : FullscreenListener {
            override fun onEnterFullscreen(fullscreenView: View, exitFullscreen: () -> Unit) {
                isFullscreen = true

                // the video will continue playing in fullscreenView
                defaultPlayerUiController.showMenuButton(false)
                mBinding.youtubePlayerView.setCustomPlayerUi(defaultPlayerUiController.rootView)


                menuButton.visibility = View.GONE
                mBinding.youtubePlayerView.visibility = View.GONE

                   val        frameMenuButton=fullscreenView.findViewById<ImageView(com.pierfrancescosoffritti.androidyoutubeplayer.core.customui.R.id.extra_views_container).   
                 frameMenuButton.visibility = View.GONE

                mBinding.fullScreenViewContainer.visibility = View.VISIBLE
                mBinding.fullScreenViewContainer.addView(fullscreenView)

            }

            override fun onExitFullscreen() {
                isFullscreen = false

                // the video will continue playing in the player
              //  defaultPlayerUiController.showMenuButton(false)
                //mBinding.youtubePlayerView.setCustomPlayerUi(defaultPlayerUiController.rootView)



                mBinding.fullScreenViewContainer.visibility = View.GONE
                mBinding.fullScreenViewContainer.removeAllViews()

                menuButton.visibility = View.GONE

                mBinding.youtubePlayerView.visibility = View.VISIBLE

            }


        })

@PierfrancescoSoffritti
Copy link
Owner

Please clarify what the issue is.

@GauravMeghanathiWeDoApps
Copy link
Author

GauravMeghanathiWeDoApps commented Dec 29, 2023

when I am going full screen video then I want to menuButton clickable false or it may be hide. if user is getting exit full screen then However I will get menu button object so then I am able to hide or disable. but First time youtubplayer.toggle full screen it will allow to user click and share that video id . I want to disable their click or menu it in Both case Full screen as well as normal screen. I am sharing a video to be easy to understand what exactly happens

[https://drive.google.com/file/d/17G2GBBDGyKpFmwimBG9hRuWAXzA9ZYAf/view?usp=share_link]

@GauravMeghanathiWeDoApps
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants