Hi There, Has anybody worked on ExoPlayer? I am fi...
# android
d
Hi There, Has anybody worked on ExoPlayer? I am finding black background before my video starts and want to remove it. Any suggestion, how can I achieve it? Thanks!
y
Hi, so if you want to remove that black background in favour of some thumbnail image, you have to use an imageview and hide it when the video starts.
But if you want to change the background color, you'll have to modify the player's surface view for that
g
Not sure, but it might be the exo_shutter view
✔️ 1
d
Thanks @Yashovardhan I am already using the imageview for the same and hiding it when receiving the PLAYER_READY state. But it is still appearing for fraction of second. Can I get any callback when player started playing the video?
@Gonçalo Palaio Yes it is exo_shutter view only. Just verified by changing its color to RED. Tried to set transparent color, but it is not allowing I assume. Can’t I hide or remove it permanently?
g
PlayerView supports a parameter to provide a layout (app:player_layout_id) I think you can choose not to give it a exo_shutter
I’m not exactly sure what is the behaviour that you will see, the shutter is there so the video surface is not shown before the first frame of the video is loaded. Do you really need to hide the shutter? Is there something in the player before?
d
Yes, checked some other docs/ blogs as well. I should not remove that shutter. Actually, I am making the player visible only when I receive the callback of STATE_READY. As, this is the state when player is just about to start playing the video. But, still I am finding the player is not ready. It shows this shutter for fraction of seconds, which generates a flicker. Do we have any other callback which can help?
g
maybe onRenderedFirstFrame ?
d
Thanks @Gonçalo Palaio! I was struggling with this since long back and was trying with event-listeners only. You just saved my life 🙂 Thanks once again!
@Gonçalo Palaio Is there any listener for finding the recycler-view state when data is rendered, or something like that?
g
The layoutmanager of the recyclerview has a onlayoutcompleted event but it’s best to search around, It might not be reliable/what you want