f

    Felix Schütz

    1 year ago
    When using Coil to load videos from URIs generated with
    ContentResolver
    , I need to explicitly pass the fetcher to the request builder, otherwise Coil cannot process the video (since the URI does not contain the file type). E.g.:
    Image(
        painter = rememberImagePainter(
            data = contentUri,
            builder = {
                fetcher(VideoFrameUriFetcher(LocalContext.current))
            },
        ),
        contentDescription = null,
    )
    Creating the
    VideoFrameUriFetcher
    instance for every video seems kind of inefficient. Is there a better Compose way?
    Alex

    Alex

    1 year ago
    Why not hoist the video frame fetcher?
    f

    Felix Schütz

    1 year ago
    Yeah, probably makes sense. Thanks.
    Alex

    Alex

    1 year ago
    The frame fetcher could live inside your viewmodel too so it won't be recreated on every recomposition, although I am not sure if
    builder
    already does some caching for you