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

Kohii is playing video in background. #107

Closed
deepanshut041 opened this issue Sep 23, 2020 · 2 comments
Closed

Kohii is playing video in background. #107

deepanshut041 opened this issue Sep 23, 2020 · 2 comments

Comments

@deepanshut041
Copy link

I'm using kohii inside fragment in recyclerview. I have bottom navigation activity in which I'm using .show() and .hide() to change fragment.

Current behavior:

Video is playing on hide fragment.

Expected behavior:

Video must pause on hide fragment and resume on show fragment.

@eneim
Copy link
Owner

eneim commented Sep 25, 2020

@deepanshut041 I guess Kohii cannot judge if the Fragment View is detached. Please try kohii.lockManager(fragment) (API:

fun lockManager(manager: Manager) {
) to lock all possible playbacks in a Fragment, and use kohii.unlockManager(fragment) to unlock it.

@deepanshut041
Copy link
Author

deepanshut041 commented Sep 25, 2020

@eneim thanks below solution worked for me

override fun onHiddenChanged(hidden: Boolean) {
    super.onHiddenChanged(hidden)
    if (hidden) {
        kohii.lockBucket(this.recyclerView);
    } else {
        kohii.unlockBucket(this.recyclerView);
    }
}

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

2 participants