To add video frame support, import the extension library:
implementation("io.coil-kt:coil-video:1.0.0-rc3")
And add the two fetchers to your component registry when constructing your ImageLoader
:
val imageLoader = ImageLoader.Builder(context)
.componentRegistry {
add(VideoFrameFileFetcher())
add(VideoFrameUriFetcher())
}
.build()
!!! Note
Video frame decoding is only supported for File
s and Uri
s (content
and file
schemes only).
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 Fetcher
explicitly for the request.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。