Skip to content

Commit fce8d69

Browse files
committed
Check in some starter thinking around a media API in bitjs.
1 parent fc0381b commit fce8d69

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

.github/workflows/node.js.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [17.x, 18.x]
19+
node-version: [17.x, 18.x, 19.x]
2020
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2121

2222
steps:

media/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dealing with digital media files (audio, video, images). Mostly a thought-experiment for now.

media/media.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
console.warn(`This is not even an alpha-level API. Do not use.`);
2+
3+
// A Container Format is a file that embeds multiple data streams into a single file.
4+
// Examples:
5+
// - the ZIP family (ZIP, JAR, CBZ, EPUB, ODF, OOXML)
6+
// - the ISO-BMFF family (MP4, HEVC, AVIF, MOV/QT, etc)
7+
// - the Matroska family (MKV, WebM)
8+
// - the RIFF family (WAV, AVI, WebP)
9+
// - the OGG family (OGV, OPUS)
10+
11+
// The ZIP container needs special processing to determine what files are present inside it :(
12+
// The ISO-BMFF container needs special processing because of its "compatible brands" array :(
13+
// The Matroska container needs special processing because the sub-type can appear anywhere :(
14+
// The OGG container needs special processing to determine what kind of streams are present :(
15+
16+
/**
17+
* @readonly
18+
* @enum {number}
19+
*/
20+
export const ContainerType = {
21+
UNKNOWN: 0,
22+
ZIP: 1,
23+
ISOBMFF: 100,
24+
MATROSKA: 101,
25+
RIFF: 102,
26+
OGG: 103,
27+
};
28+
29+
/**
30+
* @param {ArrayBuffer} ab
31+
* @returns {ContainerType}
32+
*/
33+
export function getContainerType(ab) {
34+
return ContainerType.UNKNOWN;
35+
}

0 commit comments

Comments
 (0)