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

When list loaded first video not play #4

Open
mrj976 opened this issue Dec 7, 2019 · 2 comments
Open

When list loaded first video not play #4

mrj976 opened this issue Dec 7, 2019 · 2 comments

Comments

@mrj976
Copy link

mrj976 commented Dec 7, 2019

Thank you
I have problem
When list loaded first video not play and when i scroll list first video playing
I want when list loaded first video play without scroll list
Please help me
Thanks

@paulocoutinhox
Copy link

Im with the same problem.

How can we play the first video when list loaded?

Thanks.

@paulocoutinhox
Copy link

paulocoutinhox commented Apr 9, 2021

I made a solution:

Inside your RecyclerView class create the method:

fun checkToPlayVideo() {
    if (canScrollVertically(1)) {
        playVideo(false)
    } else {
        playVideo(true)
    }
}

And when you set RecyclerView "items" you need call:

private fun updateList() {
    list?.layoutManager = createLayoutManager()
    list?.setListObjects(listData ?: ArrayList())
    list?.adapter = adapter
    list?.setHasFixedSize(true)

    Handler().postDelayed({
        list?.checkToPlayVideo()
    }, 200)
}

Thanks.

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