Comments (4)
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.
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.
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.
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)
- [Test Harness]
- [Navigation Material] onResume/onPause lifecycle events are not received for bottomSheet destination HOT 1
- [Navigation Material] Incorrect back behavior with nested navigator HOT 2
- Stop [Permissions]
- Incorrect behaviour when bottom sheet is closed by clicking on its background HOT 3
- [Navigation Material] HOT 1
- [BottomSheetNavigator] NullPointerException (race-condition?) when using back button HOT 6
- [WebView] Doesn't save state when recycled in a LazyColumn HOT 2
- [WebView] Question about backwards writes HOT 5
- Vector animation is broken with newer libraries HOT 5
- False positive deprecation message on pagerTabIndicatorOffset variant HOT 2
- onPermissionsResult isn't triggered on POST_NOTIFICATIONS permission request (API 33). HOT 2
- [Test Harness] Deprecate with replacement of `DeviceConfigurationOverride`
- Incorrect deprecation of pagerTabIndicatorOffset HOT 1
- [Permissions] Gradle update crashing permission request and the app HOT 8
- Crash when using ProgressIndicator with `accompanist-permissions` 0.34.0 HOT 1
- [Navigation Material] Crash in BottomSheetNavigator when user goes back HOT 3
- [Navigation Material] Status bar not scrimmed when bottom sheet is shown HOT 1
- [LazyColumn] scroll observation scope does not exist HOT 2
- [Feature request] LazyTable with nested scrolling support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from accompanist.