Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 1014 Bytes

README.md

File metadata and controls

29 lines (21 loc) · 1014 Bytes

Video Frames

To add video frame support, import the extension library:

implementation("io.coil-kt:coil-video:2.0.0")

And add the decoder to your component registry when constructing your ImageLoader:

val imageLoader = ImageLoader.Builder(context)
    .components {
        add(VideoFrameDecoder.Factory())
    }
    .build()

To specify the time code of the frame to extract from a video, use videoFrameMillis or videoFrameMicros:

imageView.load(File("/path/to/video.mp4")) {
    videoFrameMillis(1000)
}

If a frame time isn't specified, the first frame of the video is decoded.

The ImageLoader will automatically detect any videos and extract their frames if the request's filename/URI ends with a valid video extension. If it does not, you can set the Decoder explicitly for the request.