From 1680bd02ad831841b5cbcd2eb155aab96cca0cc3 Mon Sep 17 00:00:00 2001 From: Vanilagy <1696106+Vanilagy@users.noreply.github.com> Date: Sun, 3 May 2026 19:47:39 +0200 Subject: [PATCH] Holistic technical website cleanup --- docs/.vitepress/config.mts | 121 +++++++++++++++++++-- docs/api-config.json | 1 + docs/blog.md | 2 + docs/blog/mediabunny-now-supports-hls.md | 2 + docs/codec-registry/aac.md | 4 + docs/codec-registry/ac3.md | 4 + docs/codec-registry/alaw.md | 4 + docs/codec-registry/av1.md | 4 + docs/codec-registry/avc.md | 4 + docs/codec-registry/eac3.md | 4 + docs/codec-registry/flac.md | 4 + docs/codec-registry/hevc.md | 4 + docs/codec-registry/mp3.md | 4 + docs/codec-registry/opus.md | 4 + docs/codec-registry/overview.md | 4 + docs/codec-registry/pcm.md | 4 + docs/codec-registry/ulaw.md | 4 + docs/codec-registry/vorbis.md | 4 + docs/codec-registry/vp8.md | 4 + docs/codec-registry/vp9.md | 4 + docs/examples.md | 1 + docs/guide/converting-media-files.md | 4 + docs/guide/extensions/aac-encoder.md | 4 + docs/guide/extensions/ac3.md | 4 + docs/guide/extensions/flac-encoder.md | 4 + docs/guide/extensions/mp3-encoder.md | 4 + docs/guide/input-formats.md | 4 + docs/guide/installation.md | 4 + docs/guide/introduction.md | 4 + docs/guide/media-sinks.md | 4 + docs/guide/media-sources.md | 4 + docs/guide/output-formats.md | 4 + docs/guide/packets-and-samples.md | 4 + docs/guide/quick-start.md | 4 + docs/guide/reading-hls.md | 4 + docs/guide/reading-media-files.md | 4 + docs/guide/supported-formats-and-codecs.md | 4 + docs/guide/writing-hls.md | 1 + docs/guide/writing-media-files.md | 4 + docs/index.md | 23 ++-- docs/llms.md | 4 + examples/file-compression/index.html | 18 ++- examples/hls-transcoding/index.html | 18 ++- examples/live-recording/index.html | 18 ++- examples/media-player/index.html | 18 ++- examples/metadata-extraction/index.html | 18 ++- examples/procedural-generation/index.html | 18 ++- examples/thumbnail-generation/index.html | 18 ++- scripts/generate-api-docs.ts | 35 +++++- 49 files changed, 407 insertions(+), 41 deletions(-) diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 1f87f8d..2ed0c09 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -1,3 +1,4 @@ +/* eslint-disable @stylistic/max-len */ import { withMermaid } from 'vitepress-plugin-mermaid'; import footnote from 'markdown-it-footnote'; import tailwindcss from '@tailwindcss/vite'; @@ -7,9 +8,12 @@ import { HeadConfig } from 'vitepress'; // @ts-ignore This file gets generated once docs:generate is run import apiRoutes from '../api/index.json'; import m3u8Grammar from './m3u8-grammar.json' with { type: 'json' }; +import fs from 'node:fs/promises'; +import path from 'node:path'; const DESCRIPTION = 'A JavaScript library for reading, writing, and converting media files. Directly in the browser,' + ' and faster than anybunny else.'; +const ORIGIN = 'https://mediabunny.dev'; // https://vitepress.dev/reference/site-config export default withMermaid({ @@ -17,22 +21,31 @@ export default withMermaid({ description: DESCRIPTION, cleanUrls: true, sitemap: { - hostname: 'https://mediabunny.dev', + hostname: ORIGIN, + transformItems: async (items) => { + const entries = await fs.readdir('./examples'); + for (const entry of entries) { + const isDirectory = await fs.stat(path.join('./examples', entry)).then(stat => stat.isDirectory()); + if (isDirectory) { + items.push({ + url: `/examples/${entry}/`, // With trailing slash + }); + } + } + + return items; + }, }, - lastUpdated: true, + // lastUpdated: true, head: [ ['link', { rel: 'icon', type: 'image/png', href: '/mediabunny-logo.png' }], ['link', { rel: 'icon', type: 'image/svg+xml', href: '/mediabunny-logo.svg' }], - ['meta', { property: 'og:type', content: 'website' }], ['meta', { property: 'og:site_name', content: 'Mediabunny' }], - ['meta', { property: 'og:url', content: 'https://mediabunny.dev/' }], - ['meta', { property: 'og:image', content: 'https://mediabunny.dev/mediabunny-og-image.png' }], + ['meta', { property: 'og:image', content: `${ORIGIN}/mediabunny-og-image.png` }], ['meta', { property: 'og:locale', content: 'en-US' }], - ['meta', { property: 'og:description', content: DESCRIPTION }], - ['meta', { name: 'twitter:image', content: 'https://mediabunny.dev/mediabunny-og-image.png' }], + ['meta', { name: 'twitter:image', content: `${ORIGIN}/mediabunny-og-image.png` }], ['meta', { name: 'twitter:card', content: 'summary_large_image' }], ['meta', { name: 'twitter:site', content: '@vanilagy' }], - ['meta', { name: 'twitter:description', content: DESCRIPTION }], ], themeConfig: { logo: '/mediabunny-logo.svg', @@ -40,12 +53,12 @@ export default withMermaid({ // https://vitepress.dev/reference/default-theme-config nav: [ { text: 'Guide', link: '/guide/introduction', activeMatch: '/guide' }, - { text: 'API', link: '/api', activeMatch: '/api' }, + { text: 'API', link: '/api/', activeMatch: '/api/' }, // Trailing slash because it's index.html from there { text: 'LLMs', link: '/llms', activeMatch: '/llms' }, { text: 'Examples', link: '/examples', activeMatch: '/examples' }, { text: 'Blog', link: '/blog', activeMatch: '/blog' }, { text: 'Sponsors', link: '/#sponsors', activeMatch: '/#sponsors' }, - { text: 'License', link: 'https://github.com/Vanilagy/mediabunny#license' }, + { text: 'License', link: 'https://github.com/Vanilagy/mediabunny#license', rel: 'noopener' }, { text: 'More', items: [ @@ -186,6 +199,8 @@ export default withMermaid({ llmstxt({ ignoreFiles: [ 'api/*', + 'examples.md', + 'llms.md', ], }), ], @@ -196,14 +211,96 @@ export default withMermaid({ if (title !== 'Mediabunny') { title += ' | Mediabunny'; } - const canonicalUrl = `https://mediabunny.dev/${pageData.relativePath}` + + const canonicalUrl = `${ORIGIN}/${pageData.relativePath}` .replace(/index\.md$/, '') .replace(/\.md$/, ''); + const isBlogPost = canonicalUrl.includes('/blog/'); + + const breadcrumbs: object[] = []; + + if (canonicalUrl.includes('/guide/')) { + breadcrumbs.push({ + '@type': 'ListItem', + 'position': 1, + 'name': 'Guide', + 'item': `${ORIGIN}/guide`, + }, { + '@type': 'ListItem', + 'position': 2, + 'name': pageData.title, + }); + } + + if (canonicalUrl.includes('/api/')) { + breadcrumbs.push({ + '@type': 'ListItem', + 'position': 1, + 'name': 'API docs', + 'item': `${ORIGIN}/api/`, + }, { + '@type': 'ListItem', + 'position': 2, + 'name': pageData.title, + }); + } + + if (canonicalUrl.includes('/codec-registry/')) { + breadcrumbs.push({ + '@type': 'ListItem', + 'position': 1, + 'name': 'Codec registry', + 'item': `${ORIGIN}/codec-registry/overview`, + }, { + '@type': 'ListItem', + 'position': 2, + 'name': pageData.title, + }); + } ((pageData.frontmatter['head'] ??= []) as HeadConfig[]).push( + ['meta', { property: 'og:type', content: isBlogPost ? 'article' : 'website' }], ['meta', { property: 'og:title', content: title }], - ['meta', { property: 'twitter:title', content: title }], + ['meta', { property: 'og:description', content: pageData.description || DESCRIPTION }], + ['meta', { property: 'og:url', content: canonicalUrl }], + ['meta', { name: 'twitter:title', content: title }], + ['meta', { name: 'twitter:description', content: pageData.description || DESCRIPTION }], ['link', { rel: 'canonical', href: canonicalUrl }], ); + + if (isBlogPost) { + ((pageData.frontmatter['head'] ??= []) as HeadConfig[]).push( + ['meta', { property: 'article:published_time', content: String(pageData.frontmatter['publishedOnIso']) }], + ['meta', { property: 'article:author', content: String(pageData.frontmatter['author']) }], + ); + + breadcrumbs.push({ + '@type': 'ListItem', + 'position': 1, + 'name': 'Blog posts', + 'item': `${ORIGIN}/blog`, + }, { + '@type': 'ListItem', + 'position': 2, + 'name': pageData.title, + }); + } + + if (breadcrumbs.length > 0) { + ((pageData.frontmatter['head'] ??= []) as HeadConfig[]).push( + ['script', { type: 'application/ld+json' }, JSON.stringify({ + '@context': 'https://schema.org', + '@type': 'BreadcrumbList', + 'itemListElement': breadcrumbs, + })], + ); + } + }, + buildEnd: async () => { + const files = await fs.readdir('./docs/api'); + + for (const file of files) { + await fs.copyFile('./docs/api/' + file, './dist-docs/api/' + file); + } }, }); diff --git a/docs/api-config.json b/docs/api-config.json index e17a21a..07644e2 100644 --- a/docs/api-config.json +++ b/docs/api-config.json @@ -1,6 +1,7 @@ { "heading": "Mediabunny API reference", "intro": "Here you can find detailed documentation for all classes, functions, constants and types exposed by Mediabunny's public API.", + "description": "Detailed documentation for all classes, functions, constants and types exposed by Mediabunny's public API.", "Samples": "Raw, unencoded chunks of media data, such as video frames or sections of audio.", "Packets": "Chunks of encoded media data.", diff --git a/docs/blog.md b/docs/blog.md index 481d05b..c79f259 100644 --- a/docs/blog.md +++ b/docs/blog.md @@ -1,4 +1,6 @@ --- +title: Blog posts +description: Announcements, news, and devblogs about Mediabunny. outline: false --- diff --git a/docs/blog/mediabunny-now-supports-hls.md b/docs/blog/mediabunny-now-supports-hls.md index b9f0d39..8701ff2 100644 --- a/docs/blog/mediabunny-now-supports-hls.md +++ b/docs/blog/mediabunny-now-supports-hls.md @@ -1,6 +1,8 @@ --- title: Mediabunny now supports HLS! +description: Mediabunny v1.42.0 adds read/write support for HTTP Live Streaming (HLS), pushing the frontier of fully client-side media processing. publishedOn: April 24, 2026 +publishedOnIso: "2026-04-24" author: Vanilagy authorImage: /vani.png authorLink: https://github.com/Vanilagy diff --git a/docs/codec-registry/aac.md b/docs/codec-registry/aac.md index 5d8be50..e53b0ab 100644 --- a/docs/codec-registry/aac.md +++ b/docs/codec-registry/aac.md @@ -1,3 +1,7 @@ +--- +description: Advanced Audio Coding (AAC) audio codec definition, defining legal codec strings, decoder configs, and packet data formats. +--- + diff --git a/docs/codec-registry/ac3.md b/docs/codec-registry/ac3.md index ea0ea54..08f97ba 100644 --- a/docs/codec-registry/ac3.md +++ b/docs/codec-registry/ac3.md @@ -1,3 +1,7 @@ +--- +description: Dolby Digital (AC-3) audio codec definition, defining legal codec strings, decoder configs, and packet data formats. +--- + diff --git a/docs/codec-registry/alaw.md b/docs/codec-registry/alaw.md index 40a5f3d..29a32f4 100644 --- a/docs/codec-registry/alaw.md +++ b/docs/codec-registry/alaw.md @@ -1,3 +1,7 @@ +--- +description: A-law companded PCM audio codec definition, defining legal codec strings, decoder configs, and packet data formats. +--- + diff --git a/docs/codec-registry/av1.md b/docs/codec-registry/av1.md index a0fa961..95a4b36 100644 --- a/docs/codec-registry/av1.md +++ b/docs/codec-registry/av1.md @@ -1,3 +1,7 @@ +--- +description: AOMedia Video 1 (AV1) video codec definition, defining legal codec strings, decoder configs, and packet data formats. +--- + diff --git a/docs/codec-registry/avc.md b/docs/codec-registry/avc.md index 620be2e..3bef0c7 100644 --- a/docs/codec-registry/avc.md +++ b/docs/codec-registry/avc.md @@ -1,3 +1,7 @@ +--- +description: Advanced Video Coding (H.264) video codec definition, defining legal codec strings, decoder configs, and packet data formats. +--- + diff --git a/docs/codec-registry/eac3.md b/docs/codec-registry/eac3.md index b2910e9..6d94d1b 100644 --- a/docs/codec-registry/eac3.md +++ b/docs/codec-registry/eac3.md @@ -1,3 +1,7 @@ +--- +description: Dolby Digital Plus (E-AC-3) audio codec definition, defining legal codec strings, decoder configs, and packet data formats. +--- + diff --git a/docs/codec-registry/flac.md b/docs/codec-registry/flac.md index f6ee25c..41daf9d 100644 --- a/docs/codec-registry/flac.md +++ b/docs/codec-registry/flac.md @@ -1,3 +1,7 @@ +--- +description: Free Lossless Audio Codec (FLAC) audio codec definition, defining legal codec strings, decoder configs, and packet data formats. +--- + diff --git a/docs/codec-registry/hevc.md b/docs/codec-registry/hevc.md index 901f2c5..5d3111c 100644 --- a/docs/codec-registry/hevc.md +++ b/docs/codec-registry/hevc.md @@ -1,3 +1,7 @@ +--- +description: High Efficiency Video Coding (H.265) video codec definition, defining legal codec strings, decoder configs, and packet data formats. +--- + diff --git a/docs/codec-registry/mp3.md b/docs/codec-registry/mp3.md index 1f74a09..c4ef452 100644 --- a/docs/codec-registry/mp3.md +++ b/docs/codec-registry/mp3.md @@ -1,3 +1,7 @@ +--- +description: MP3 (MPEG-1/2 Audio Layer III) audio codec definition, defining legal codec strings, decoder configs, and packet data formats. +--- + diff --git a/docs/codec-registry/opus.md b/docs/codec-registry/opus.md index a091b9f..45f5da2 100644 --- a/docs/codec-registry/opus.md +++ b/docs/codec-registry/opus.md @@ -1,3 +1,7 @@ +--- +description: Opus audio codec definition, defining legal codec strings, decoder configs, and packet data formats. +--- + diff --git a/docs/codec-registry/overview.md b/docs/codec-registry/overview.md index 691a8a9..cee3639 100644 --- a/docs/codec-registry/overview.md +++ b/docs/codec-registry/overview.md @@ -1,3 +1,7 @@ +--- +description: The Mediabunny Codec Registry formalizes the precise definitions of all video and audio codecs supported by Mediabunny, like expected codec string and packet data format. +--- + # Mediabunny Codec Registry The Mediabunny Codec Registry formalizes the precise definitions of all video and audio codecs supported by Mediabunny. More specifically, for any given codec, it describes the format that `EncodedPacket`, `VideoDecoderConfig` and `AudioDecoderConfig` must adhere to. All packets coming out of or going into Mediabunny are expected to adhere to this registry. diff --git a/docs/codec-registry/pcm.md b/docs/codec-registry/pcm.md index a06a9b5..dc6b28e 100644 --- a/docs/codec-registry/pcm.md +++ b/docs/codec-registry/pcm.md @@ -1,3 +1,7 @@ +--- +description: PCM audio codec definitions, defining legal codec strings, decoder configs, and packet data formats. +--- + diff --git a/docs/codec-registry/ulaw.md b/docs/codec-registry/ulaw.md index beb1146..d95a8b7 100644 --- a/docs/codec-registry/ulaw.md +++ b/docs/codec-registry/ulaw.md @@ -1,3 +1,7 @@ +--- +description: μ-law companded PCM audio codec definition, defining legal codec strings, decoder configs, and packet data formats. +--- + diff --git a/docs/codec-registry/vorbis.md b/docs/codec-registry/vorbis.md index 9867d9c..65252ad 100644 --- a/docs/codec-registry/vorbis.md +++ b/docs/codec-registry/vorbis.md @@ -1,3 +1,7 @@ +--- +description: Vorbis audio codec definition, defining legal codec strings, decoder configs, and packet data formats. +--- + diff --git a/docs/codec-registry/vp8.md b/docs/codec-registry/vp8.md index 13e8c90..5847833 100644 --- a/docs/codec-registry/vp8.md +++ b/docs/codec-registry/vp8.md @@ -1,3 +1,7 @@ +--- +description: VP8 video codec definition, defining legal codec strings, decoder configs, and packet data formats. +--- + diff --git a/docs/codec-registry/vp9.md b/docs/codec-registry/vp9.md index e3d98b9..ca51fe4 100644 --- a/docs/codec-registry/vp9.md +++ b/docs/codec-registry/vp9.md @@ -1,3 +1,7 @@ +--- +description: VP9 video codec definition, defining legal codec strings, decoder configs, and packet data formats. +--- + diff --git a/docs/examples.md b/docs/examples.md index 42f4b61..9b8cf34 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -1,4 +1,5 @@ --- +description: "Demos showcasing the various features of Mediabunny: metadata extraction, thumbnail generation, compression, media playback, live streaming, and more." layout: home title: Examples diff --git a/docs/guide/converting-media-files.md b/docs/guide/converting-media-files.md index 05c894e..4067d29 100644 --- a/docs/guide/converting-media-files.md +++ b/docs/guide/converting-media-files.md @@ -1,3 +1,7 @@ +--- +description: Efficiently convert any media file to any format, directly in the browser. Optionally apply trimming, video resizing, rotation, custom overlays, and more. +--- + # Converting media files The [reading](./reading-media-files) and [writing](./writing-media-files) primitives in Mediabunny provide everything you need to convert media files. However, since this is such a common operation and the details can be tricky, Mediabunny ships with a built-in file conversion abstraction. diff --git a/docs/guide/extensions/aac-encoder.md b/docs/guide/extensions/aac-encoder.md index a8b3488..5bc3237 100644 --- a/docs/guide/extensions/aac-encoder.md +++ b/docs/guide/extensions/aac-encoder.md @@ -1,3 +1,7 @@ +--- +description: The @mediabunny/aac-encoder extension provides a fast AAC encoder polyfill for use in the browser and on the server. +--- + # @mediabunny/aac-encoder Some browsers lack support for AAC encoding in their WebCodecs implementations. This extension package provides a reliable AAC-LC encoder for use with Mediabunny. It is implemented using Mediabunny's [custom coder API](../supported-formats-and-codecs#custom-coders) and uses a fast, size-optimized WASM build of [FFmpeg](https://ffmpeg.org/)'s AAC encoder under the hood. diff --git a/docs/guide/extensions/ac3.md b/docs/guide/extensions/ac3.md index e3167e5..35bfad0 100644 --- a/docs/guide/extensions/ac3.md +++ b/docs/guide/extensions/ac3.md @@ -1,3 +1,7 @@ +--- +description: The @mediabunny/ac3 extension provides fast AC-3 and E-AC-3 decoders and encoders for both browser and server environments. +--- + # @mediabunny/ac3 Browsers have no support for AC-3 (Dolby Digital) or E-AC-3 (Dolby Digital Plus) in their WebCodecs implementations. This extension package provides both a decoder and encoder for use with Mediabunny, allowing you to decode and encode these codecs directly in the browser. It is implemented using Mediabunny's [custom coder API](../supported-formats-and-codecs#custom-coders) and uses a fast, size-optimized WASM build of [FFmpeg](https://ffmpeg.org/)'s AC-3 and E-AC-3 coders under the hood. diff --git a/docs/guide/extensions/flac-encoder.md b/docs/guide/extensions/flac-encoder.md index 34ae4d7..c36af5d 100644 --- a/docs/guide/extensions/flac-encoder.md +++ b/docs/guide/extensions/flac-encoder.md @@ -1,3 +1,7 @@ +--- +description: The @mediabunny/flac-encoder extension provides a highly-performant FLAC encoder polyfill for use in the browser and on the server. +--- + # @mediabunny/flac-encoder No browser currently supports FLAC encoding in their WebCodecs implementations. This extension package provides a reliable FLAC encoder for use with Mediabunny. It is implemented using Mediabunny's [custom coder API](../supported-formats-and-codecs#custom-coders) and uses a fast, size-optimized WASM build of [libFLAC](https://github.com/xiph/flac) under the hood. diff --git a/docs/guide/extensions/mp3-encoder.md b/docs/guide/extensions/mp3-encoder.md index 64a32b4..6965c56 100644 --- a/docs/guide/extensions/mp3-encoder.md +++ b/docs/guide/extensions/mp3-encoder.md @@ -1,3 +1,7 @@ +--- +description: The @mediabunny/mp3-encoder extension provides a highly-performant MP3 encoder polyfill for use in the browser and on the server. +--- + # @mediabunny/mp3-encoder Browsers typically have no support for MP3 encoding in their WebCodecs implementations. Given the ubiquity of the format, this extension package provides an MP3 encoder for use with Mediabunny. It is implemented using Mediabunny's [custom coder API](../supported-formats-and-codecs#custom-coders) and uses a highly-performant WASM build of the [LAME MP3 Encoder](https://lame.sourceforge.io/) under the hood. diff --git a/docs/guide/input-formats.md b/docs/guide/input-formats.md index 149f8a9..fc47e3e 100644 --- a/docs/guide/input-formats.md +++ b/docs/guide/input-formats.md @@ -1,3 +1,7 @@ +--- +description: Mediabunny supports a wide range of media input formats, such as MP4, WebM, MP3, HLS, and many more. +--- + # Input formats Mediabunny supports a wide variety of commonly used container formats for reading input files. These *input formats* are used in two ways: diff --git a/docs/guide/installation.md b/docs/guide/installation.md index fb08176..67abf2a 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -1,3 +1,7 @@ +--- +description: Install Mediabunny using npm (or your favorite package manager), or include it directly as a + + + + + + + + + + + + +
diff --git a/examples/hls-transcoding/index.html b/examples/hls-transcoding/index.html index 0187730..0cc49f0 100644 --- a/examples/hls-transcoding/index.html +++ b/examples/hls-transcoding/index.html @@ -1,15 +1,29 @@ - + - +