mediaResolverProvider top-level property
The media resolver used by the native render pipeline: a real
MediaRepository over the injected loader plus the clip probe/extraction
services, streaming clip frames through an on-disk FileClipFrameStore so a
full-resolution or long clip never has to hold every decoded frame in
memory, and serving them from the persistent clipFrameCacheProvider so an
unchanged clip is not re-extracted on every run. Overridable with a fake in
tests; NoMediaResolver stays exported as the deliberate media-less choice.
The store is dropped when clipFrameStreamingProvider is off, because the
streaming window is filled only by the capture loop's prepareClipFrames: a
caller with no loop (a live preview) must decode every planned frame up
front or paint's synchronous lookup misses.
Building the resolver also kicks off the orphan sweep: it is the one place every native run passes through, it is off the render's critical path (unawaited), and the sweep swallows its own errors, so a render never waits on it or fails with it.
Implementation
final mediaResolverProvider = Provider<MediaResolver>((ref) {
unawaited(ref.watch(staleTempSweeperProvider).sweep());
return MediaRepository(
loader: ref.watch(mediaBytesLoaderProvider),
probeService: ref.watch(videoProbeServiceProvider),
frameExtractor: ref.watch(frameExtractionServiceProvider),
clipFrameStore: ref.watch(clipFrameStreamingProvider) ? FileClipFrameStore() : null,
clipFrameCache: ref.watch(clipFrameCacheProvider),
maxClipDecodeEdge: ref.watch(clipDecodeMaxEdgeProvider),
);
});