Closed varun7952 closed 2 months ago
@varun7952,
Thanks for reporting! Could you please send the bug report to android-media-github@google.com?
@varun7952,
Thanks for reporting! Could you please send the bug report to android-media-github@google.com?
I am not sure whether its bug or issue with my code. Could you please let me know that my code is ok and its a bug?
@varun7952, we can't give 1:1 support for solving app specific issues. In the absence of bug report, we don't know it's a problem with our library neither, thus we cannot provide helpful answers I'm afraid.
@varun7952, we can't give 1:1 support for solving app specific issues. In the absence of bug report, we don't know it's a problem with our library neither, thus we cannot provide helpful answers I'm afraid.
Yes not asking for the 1:1 support but exoplayer in recyclerview is the common use for applications, just need to know if i am doing anything wrong in changing media by seekTo option of exoplayer or there is any other method i can use to change next/previous track in my case
@varun7952,
1) seekTo
is a proper approach here, so you don't have to worry about that
2) The fact that the audio is playing indicates that, at least on the Player
side, the playback works as expected
3) Missing video + controls means that rendering to the surface is the issue
I think the root cause could hide somewhere in your prepareExoPlayer
method. It seems to be doing a lot and I don't know if all of those actions are needed in onBindViewHolder()
.
You might want to try: https://github.com/androidx/media/blob/b01c6ffcb3fca3d038476dab5d3bc9c9f2010781/libraries/ui/src/main/java/androidx/media3/ui/PlayerView.java#L608-L609
Alternatively, add more logging around exoPlayerView.setPlayer(player)
to see what the state of the player is at that point and if any previous views still have reference to the player?
Perhaps your private class Viewholder extends RecyclerView.ViewHolder
could also be modified:
private class Viewholder extends RecyclerView.ViewHolder implements View.OnAttachStateChangeListener
itemView.addOnAttachStateChangeListener(this)
onViewAttachedToWindow
and onViewDetachedFromWindow
to setup and release the Player
properly@varun7952,
1. `seekTo` is a proper approach here, so you don't have to worry about that 2. The fact that the audio is playing indicates that, at least on the `Player` side, the playback works as expected 3. Missing video + controls means that rendering to the surface is the issue
I think the root cause could hide somewhere in your
prepareExoPlayer
method. It seems to be doing a lot and I don't know if all of those actions are needed inonBindViewHolder()
.You might want to try:
Alternatively, add more logging around
exoPlayerView.setPlayer(player)
to see what the state of the player is at that point and if any previous views still have reference to the player?Perhaps your
private class Viewholder extends RecyclerView.ViewHolder
could also be modified:* `private class Viewholder extends RecyclerView.ViewHolder implements View.OnAttachStateChangeListener` * `itemView.addOnAttachStateChangeListener(this)` * implement `onViewAttachedToWindow` and `onViewDetachedFromWindow` to setup and release the `Player` properly
Thanks for the suggestions and pointing things out. i will test these and update with my code and log again.
Hey @varun7952. We need more information to resolve this issue but there hasn't been an update in 14 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Since there haven't been any recent updates here, I am going to close this issue.
@varun7952 if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.
I have created a single instance of
ExoPlayer
to be used throughout aRecyclerView
in my app (a chat screen). When a user clicks on a video thumbnail, I pass a list of URIs to the ExoPlayer class:When ExoPlayer start playing a video in recyclerView, it works fine when using the next and previous buttons of ExoPlayer. However, the problem starts when I swipe for next or previous video RecyclerView. I tried using the
seekTo
method of ExoPlayer to move to the next/previous video, but after implementingseekto
, on swiping only the audio plays next or previous video's audio also I don't see any controls or video.RecyclerView class
ExoplayerSingle_Instance Class
Problem
Tried Solutions
Expected Behavior
Actual Behavior
Environment
What would be the solution to this issue?