Giter Site home page Giter Site logo

Video player blinks in RecyclerView about kohii HOT 5 CLOSED

sdex avatar sdex commented on June 1, 2024 1
Video player blinks in RecyclerView

from kohii.

Comments (5)

eneim avatar eneim commented on June 1, 2024

@sdex Sorry for not checking this issue. Want to confirm the issue: the "blink" you mention is a short time when the screen turns white? I believe it is because you are reusing the PlayerView instance. And because the PlayerView instance is reused, the keep_content_on_player_reset setting doesn't take effect.

If you can trade-off the memory usage to get better performance, you can replace your container (which is not a PlayerView I believe) with a PlayerView. That way, the PlayerView will not be replaced (unless it is recycled by RecyclerView of course).

Please try this and let me know if it solves your issue.

from kohii.

sdex avatar sdex commented on June 1, 2024

@eneim correct, white screen instead of the last visible frame.
Not sure what exactly I need to replace with PlayerView. I have a list item view with the structure:

LinearLayout
  ConstraintLayout
    PlayerView

And in the view holder I do:

kohii.setUp(mediaLink).bind(playerView)

After all, we came up with listening to the player events and displaying a thumbnail when playback is not started yet.
It's not a perfect solution but it minimizes UI lags during scrolling.

from kohii.

eneim avatar eneim commented on June 1, 2024

@sdex

Not sure what exactly I need to replace with PlayerView.

Yeah, your current structure would be what I recommend. I also acknowledge your concern now: by default, there is nothing shown in the PlayerView if the video is not playing (for example, before the beginning of the playback, during the buffering for the first playback, after the playback has ended) which cause the UI to look weird (black screen, or white, ...).

I think the approach that uses player events to show/hide the thumbnail is reasonable. There is ArtworkHintListener interface you can set when calling kohii.setUp, you can try that and see if it helps your case as well.

from kohii.

sdex avatar sdex commented on June 1, 2024

@eneim eventually we got what we needed listening events from different callbacks:
Playback.StateListener, Playback.ArtworkHintListener, Player.Listener
Based on the event and the player state we either show or hide the thumbnail and the controller.

from kohii.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.