Skip to content
This repository was archived by the owner on Jul 20, 2021. It is now read-only.
This repository was archived by the owner on Jul 20, 2021. It is now read-only.

Video Player crashing when scrolled out of view and then back into view #89

Description

@skroth
  • I have verified there are no duplicate active or recent bugs, questions, or requests

  • I have verified that I am using the latest version of Better Video Player.

  • I have given my issue a non-generic title.

  • I have read over the documentation (before asking questions on how to do something).

  • Better Video Player version: kotlin-SNAPSHOT

  • Device OS version: 8.0

  • Device Manufacturer: LG

  • Device Name: G7

Reproduction Steps
  1. Put the player in a scrolling view
  2. scroll the player out of view
  3. scroll the player back into view
Expected Result

App doesn't crash

Actual Result

App crashes

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.foo.bar.debug, PID: 25435
    java.lang.IllegalStateException
        at android.media.MediaPlayer.getCurrentPosition(Native Method)
        at com.halilibo.bvpkotlin.captions.CaptionsView.run(CaptionsView.kt:34)
        at android.os.Handler.handleCallback(Handler.java:789)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6759)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)

I have the player in a RecyclerView, but I have confirmed that the view is not being recycled when this occurs, so I don't believe that it has something specifically to do with RecyclerView. I have noticed that onDetachedFromWindow and onSurfaceTextureDestroyed are being called as I scroll it out of view, so I'm guessing that the media player is being released, and then when it comes back into view the CaptionsView is trying to use the released media player.

Anyway, apologies if this is not a real bug and I am just doing something wrong. If that's the case, if someone could point me in the right direction on how to solve this it would be great.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions