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 make playerview full screen button with seeker button for volume #486

Open
hafiz013 opened this issue Apr 28, 2020 · 2 comments
Open

Comments

@hafiz013
Copy link

May i know this library can support for full screen button and seekbar button for volume control.tq

@shivamsoods
Copy link

No
There is no generic solution in the library current to make the videos full screen but you can use a Dialog to create a full screen and add remove the player from main view and add it to the Dialog box.

Initialize the Fullscreen Dialog

private fun initFullScreenDialog() {
        fullScreenDialog =
            object : Dialog(context, android.R.style.Theme_Black_NoTitleBar_Fullscreen) {

                override fun onBackPressed() {
                    closeFullScreenDialog()
                    super.onBackPressed()
                }
           }
    }

Open the Full Screen

 private fun openFullScreenDialog() 
        isFullScreen = true
        (player_view.parent as ViewGroup).removeView(player_view)

        player_view.resizeMode = AspectRatioFrameLayout.RESIZE_MODE_FIT
        fullScreenDialog.addContentView(
            playerview,
            ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT
            )
        )
        fullScreenDialog.show()

    }

Closing the full screen

private fun closeFullScreenDialog() {
        isFullScreen = false

        (player_view.parent as ViewGroup).removeView(player_view)
        fullScreenDialog.dismiss()
        player_view.resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM
        MainLinearLayout.addView(player_view)
        player_view.requestFocus()
    }

You can refer to this link for further understanding.

@eneim
Copy link
Owner

eneim commented Jun 30, 2020

@hafiz013 To create fullscreen player, there is an existing sample in the Facebook demo:

if (ScreenHelper.shouldUseBigPlayer(windowManager.getDefaultDisplay())) {
It is not trivial, but you can follow that. This sample will automatically open full screen player if user rotates the device. You can modify the control flow to make it manual.

About the volume seekbar, it is not the scope of this library, you should consult the ExoPlayer library about customizing the PlayerView UI. To update volume manually, please use the method setVolumeInfo in the Helper class.

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

No branches or pull requests

3 participants