androidimageexoplayer

how can I Display image in ExoPlayer?


I have list of URLs mix with videos and images. I want to display both using ExoPlayer. I could display videos in the ExoPlayer, however when I try to display image I am getting a black screen.

Thank you in advance.


Solution

  • I use exoplayer-ui:r2.5.4 and SimpleExoPlayerView has built in image view.
    you can set your image with default_artwork attribute in xml, for example:

    <com.google.android.exoplayer2.ui.SimpleExoPlayerView
        android:id="@+id/playerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:default_artwork="@drawable/default_media_artwork"
        app:use_artwork="true"/>
    

    Hope to be useful.