Git Product home page Git Product logo

Comments (4)

chrisbanes avatar chrisbanes commented on April 20, 2024 1

Ah, turns out that Coil has support for this: https://coil-kt.github.io/coil/videos/

I haven't tried this, but it should then work as:

CoilImage(
    data = videoUri,
    requestBuilder = {
        videoFrameMillis(1000)
    },
    contentScale = ContentScale.Crop,
)

from accompanist.

Jeyhey avatar Jeyhey commented on April 20, 2024 1

Thank you, this perfectly solves my problem. I only had to write my own VideoFrameUriFetcher to always return true in handles as the uri's last path segment does not indicate that it is a video (uri.toString() looks rather like this: 'content://media/external/video/media/15383').

from accompanist.

chrisbanes avatar chrisbanes commented on April 20, 2024

Hmmm, do you're not really using Coil here at all, as you're just displaying a Bitmap. You could replace CoilImage with Image and it would work the same.

You should look at our Asynchronous operations in Compose doc to get an idea of how to do this (specifically the bit about LaunchedEffect)

from accompanist.

Jeyhey avatar Jeyhey commented on April 20, 2024

Hi Chris, thank you for your rapid reply. Indeed, I was thinking about using Image directly. Because I have a very large grid displaying thumbnails of all videos of the device, I thought using the build in caching and asynchronous loading of CoilImage instead of writing it myself. Also, because CoilImage can be used to display the images of the device, I thought I can use it to display video thumbnails.

I'll take a look at your links and think about how implementing it using Image.

Edit: I know the solution above fetches the bitmap directly and passes it to CoilImage. That was only a first attempt, and I looked for a way to delegate the call to Uri.thumbnailFromVideoAt to some suspend function of CoilImage.

from accompanist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.