mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-08 00:03:58 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c0ce3458b | ||
|
|
09190b4e6e | ||
|
|
e13f3ecead | ||
|
|
3d97d089a3 | ||
|
|
6c388a9915 | ||
|
|
e992502d21 | ||
|
|
15f49ed538 | ||
|
|
4ef2d2719c |
@@ -35,6 +35,7 @@ export default withMermaid({
|
||||
nav: [
|
||||
{ text: 'Guide', link: '/guide/introduction', activeMatch: '/guide' },
|
||||
{ text: 'API', link: '/api', activeMatch: '/api' },
|
||||
{ text: 'LLMs', link: '/llms', activeMatch: '/llms' },
|
||||
{ text: 'Examples', link: '/examples', activeMatch: '/examples' },
|
||||
{ text: 'Sponsors', link: '/#sponsors', activeMatch: '/#sponsors' },
|
||||
{ text: 'License', link: 'https://github.com/Vanilagy/mediabunny#license' },
|
||||
@@ -121,7 +122,11 @@ export default withMermaid({
|
||||
plugins: [
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
tailwindcss() as any,
|
||||
llmstxt(),
|
||||
llmstxt({
|
||||
ignoreFiles: [
|
||||
'api/*',
|
||||
],
|
||||
}),
|
||||
],
|
||||
},
|
||||
outDir: '../dist-docs',
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 80 KiB |
@@ -103,6 +103,7 @@ const sponsors = {
|
||||
{ image: 'https://avatars.githubusercontent.com/u/84167135', name: 'Memenome', url: 'https://github.com/memenome' },
|
||||
{ image: 'https://avatars.githubusercontent.com/u/5913254', name: 'Brandon McConnell', url: 'https://github.com/brandonmcconnell' },
|
||||
{ image: 'https://avatars.githubusercontent.com/u/9549394', name: 'studnitz', url: 'https://github.com/studnitz' },
|
||||
{ image: 'https://avatars.githubusercontent.com/u/504909', name: 'Hirbod', url: 'https://github.com/hirbod' },
|
||||
{ image: 'https://avatars.githubusercontent.com/u/30229596', name: 'Pablo Bonilla', url: 'https://github.com/devPablo' },
|
||||
{ image: 'https://avatars.githubusercontent.com/u/63088713', name: 'taf2000', url: 'https://github.com/taf2000' },
|
||||
{ image: 'https://avatars.githubusercontent.com/u/58149663', name: 'H7GhosT', url: 'https://github.com/H7GhosT' },
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# Mediabunny and LLMs
|
||||
|
||||
<div class="grid place-items-center my-14">
|
||||
<div class="relative">
|
||||
<div class="absolute top-0 left-0 size-full rounded-full" style="background: var(--vp-home-hero-image-background-image); filter: var(--vp-home-hero-image-filter)"></div>
|
||||
<img src="./assets/mediarobot.svg" width="250" class="relative">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
While Mediabunny is proudly human-coded, we want to encourage any and all usage of Mediabunny, even when the vibes are high.
|
||||
|
||||
Mediabunny is still new and is unlikely to be in the training data of modern LLMs, but we can still make the AI perform extremely well by just giving it a little more context.
|
||||
|
||||
---
|
||||
|
||||
Give one or more of these files to your LLM:
|
||||
|
||||
### [mediabunny.d.ts](/mediabunny.d.ts)
|
||||
|
||||
This file contains the entire public TypeScript API of Mediabunny and is commented extremely thoroughly.
|
||||
|
||||
### [llms.txt](/llms.txt)
|
||||
|
||||
This file provides an index of Mediabunny's guide, which the AI can then further dive into if it wants to.
|
||||
|
||||
### [llms-full.txt](/llms-full.txt)
|
||||
|
||||
This is just the entire Mediabunny guide in a single file.
|
||||
@@ -2,6 +2,7 @@ import {
|
||||
ALL_FORMATS,
|
||||
AudioBufferSink,
|
||||
BlobSource,
|
||||
BufferSource,
|
||||
CanvasSink,
|
||||
Input,
|
||||
UrlSource,
|
||||
@@ -91,7 +92,7 @@ const initMediaPlayer = async (resource: File | string) => {
|
||||
|
||||
// Create an Input from the resource
|
||||
const source = resource instanceof File
|
||||
? new BlobSource(resource)
|
||||
? new BufferSource(await resource.arrayBuffer())// new BlobSource(resource)
|
||||
: new UrlSource(resource);
|
||||
const input = new Input({
|
||||
source,
|
||||
@@ -191,6 +192,7 @@ const initMediaPlayer = async (resource: File | string) => {
|
||||
if (!videoSink) {
|
||||
// If there's only an audio track, always show the controls
|
||||
controlsElement.style.opacity = '1';
|
||||
controlsElement.style.pointerEvents = '';
|
||||
playerContainer.style.cursor = '';
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -642,6 +644,13 @@ const formatSeconds = (seconds: number) => {
|
||||
return result;
|
||||
};
|
||||
|
||||
window.addEventListener('resize', () => {
|
||||
if (totalDuration) {
|
||||
updateProgressBarTime(getPlaybackTime());
|
||||
durationElement.textContent = formatSeconds(totalDuration);
|
||||
}
|
||||
});
|
||||
|
||||
/** === FILE SELECTION LOGIC === */
|
||||
|
||||
selectMediaButton.addEventListener('click', () => {
|
||||
|
||||
Generated
+6
-6
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "mediabunny",
|
||||
"version": "1.13.1",
|
||||
"version": "1.13.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "mediabunny",
|
||||
"version": "1.13.1",
|
||||
"version": "1.13.2",
|
||||
"license": "MPL-2.0",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
@@ -7749,9 +7749,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/mediabunny": {
|
||||
"version": "1.13.0",
|
||||
"resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.13.0.tgz",
|
||||
"integrity": "sha512-eAtCVOzceN3VkExQmYrDB+3bM6d98PfB6AhgueojYG6T5SNzc4cRR2gWm0oZ1HjhNN0J4hjtvtEpJ+AAMXF/dQ==",
|
||||
"version": "1.13.1",
|
||||
"resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.13.1.tgz",
|
||||
"integrity": "sha512-Fht/ujfoS0jt8s9W4zDEilnWVsafkBaiIQ5BX0x1tdvM4PClexgYIWDZSf6kC82/c9Bo3ehZPIIfS3aJ9younA==",
|
||||
"license": "MPL-2.0",
|
||||
"peer": true,
|
||||
"workspaces": [
|
||||
@@ -12242,7 +12242,7 @@
|
||||
},
|
||||
"packages/mp3-encoder": {
|
||||
"name": "@mediabunny/mp3-encoder",
|
||||
"version": "1.13.1",
|
||||
"version": "1.13.2",
|
||||
"license": "MPL-2.0",
|
||||
"devDependencies": {
|
||||
"@types/emscripten": "^1.40.1"
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "mediabunny",
|
||||
"author": "Vanilagy",
|
||||
"version": "1.13.1",
|
||||
"version": "1.13.2",
|
||||
"description": "Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.",
|
||||
"type": "module",
|
||||
"workspaces": [
|
||||
@@ -33,7 +33,7 @@
|
||||
"check": "tsc -p src --noEmit && tsc -p packages/mp3-encoder/src --noEmit && tsc -p scripts --noEmit && tsc -p tsconfig.vite.json --noEmit && rm tsconfig.vite.tsbuildinfo",
|
||||
"check-docblocks": "tsx scripts/check-docblocks.ts dist/mediabunny.d.ts",
|
||||
"docs:dev": "vitepress dev docs",
|
||||
"docs:build": "npm run docs:generate && vitepress build docs && npm run examples:build",
|
||||
"docs:build": "npm run build && npm run docs:generate && vitepress build docs && npm run examples:build && cp dist/mediabunny.d.ts dist-docs/",
|
||||
"docs:preview": "vitepress preview docs",
|
||||
"docs:generate": "tsx scripts/generate-api-docs.ts src/index.ts packages/mp3-encoder/src/index.ts docs/api-config.json",
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@mediabunny/mp3-encoder",
|
||||
"author": "Vanilagy",
|
||||
"version": "1.13.1",
|
||||
"version": "1.13.2",
|
||||
"description": "MP3 encoder extension for Mediabunny, based on LAME.",
|
||||
"main": "./dist/bundles/mediabunny-mp3-encoder.mjs",
|
||||
"module": "./dist/bundles/mediabunny-mp3-encoder.mjs",
|
||||
|
||||
+10
-12
@@ -75,9 +75,7 @@ export class Mp3Demuxer extends Demuxer {
|
||||
}
|
||||
}
|
||||
|
||||
const startPos = this.lastLoadedPos;
|
||||
|
||||
const result = await readNextFrameHeader(this.reader, startPos, this.reader.fileSize);
|
||||
const result = await readNextFrameHeader(this.reader, this.lastLoadedPos, this.reader.fileSize);
|
||||
if (!result) {
|
||||
this.lastSampleLoaded = true;
|
||||
return;
|
||||
@@ -89,16 +87,16 @@ export class Mp3Demuxer extends Demuxer {
|
||||
|
||||
const xingOffset = getXingOffset(header.mpegVersionId, header.channel);
|
||||
|
||||
let slice = this.reader.requestSlice(startPos + xingOffset, 4);
|
||||
let slice = this.reader.requestSlice(result.startPos + xingOffset, 4);
|
||||
if (slice instanceof Promise) slice = await slice;
|
||||
assert(slice);
|
||||
if (slice) {
|
||||
const word = readU32Be(slice);
|
||||
const isXing = word === XING || word === INFO;
|
||||
|
||||
const word = readU32Be(slice);
|
||||
const isXing = word === XING || word === INFO;
|
||||
|
||||
if (isXing) {
|
||||
// There's no actual audio data in this frame, so let's skip it
|
||||
return;
|
||||
if (isXing) {
|
||||
// There's no actual audio data in this frame, so let's skip it
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.firstFrameHeader) {
|
||||
@@ -109,7 +107,7 @@ export class Mp3Demuxer extends Demuxer {
|
||||
const sample: Sample = {
|
||||
timestamp: this.nextTimestampInSamples / header.sampleRate,
|
||||
duration: sampleDuration,
|
||||
dataStart: startPos,
|
||||
dataStart: result.startPos,
|
||||
dataSize: header.totalSize,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user