Add thumbnail generation example, fix MP3 detection code error, prefer canvas element over OffscreenCanvas

This commit is contained in:
Vanilagy
2025-05-23 18:52:09 +02:00
parent c620b3e753
commit 4bbb6edf5d
7 changed files with 185 additions and 13 deletions
+7 -4
View File
@@ -3,14 +3,17 @@ layout: home
hero:
text: Examples
tagline: Various demos showcasing the usage of the features of Mediakit
tagline: Demos showcasing the usage of various features of Mediakit
features:
- title: Metadata extraction
details: See how you can extract various metadata from an input media file.
details: Extract various metadata from an input media file
link: /examples/metadata-extraction
- title: Feature B
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
target: _self
- title: Thumbnail generation
details: Generate multiple small thumbnails for a video track
link: /examples/thumbnail-generation
target: _self
- title: Feature C
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: Feature A
+1 -1
View File
@@ -291,7 +291,7 @@ for await (const sample of keyFrameSamples) {
While `VideoSampleSink` extracts raw decoded video samples, you can use `CanvasSink` to extract these samples as canvases instead. In doing so, certain operations such as scaling and rotating can also be handled by the sink. The downside is the additional VRAM requirements for the canvases' framebuffers.
::: info
This sink yields `OffscreenCanvas` whenever possible, and falls back to `HTMLCanvasElement` otherwise.
This sink yields `HTMLCanvasElement` whenever possible, and falls back to `OffscreenCanvas` otherwise (in Worker contexts, for example).
:::
Create the sink like so: