mediabunny 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/mediabunny.cjs +18 -9
- package/dist/bundles/mediabunny.min.cjs +3 -3
- package/dist/bundles/mediabunny.min.mjs +3 -3
- package/dist/bundles/mediabunny.mjs +18 -9
- package/dist/modules/src/input-format.js +1 -1
- package/dist/modules/src/matroska/ebml.d.ts +2 -2
- package/dist/modules/src/matroska/ebml.d.ts.map +1 -1
- package/dist/modules/src/matroska/ebml.js +3 -4
- package/dist/modules/src/matroska/matroska-demuxer.js +3 -3
- package/dist/modules/src/source.d.ts.map +1 -1
- package/dist/modules/src/source.js +17 -1
- package/dist/modules/src/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/input-format.ts +1 -1
- package/src/matroska/ebml.ts +3 -4
- package/src/matroska/matroska-demuxer.ts +3 -3
- package/src/source.ts +22 -2
|
@@ -5549,8 +5549,7 @@ var Mediabunny = (() => {
|
|
|
5549
5549
|
}
|
|
5550
5550
|
this.writer.write(this.helper.subarray(0, pos));
|
|
5551
5551
|
}
|
|
5552
|
-
|
|
5553
|
-
writeString(str) {
|
|
5552
|
+
writeAsciiString(str) {
|
|
5554
5553
|
this.writer.write(new Uint8Array(str.split("").map((x) => x.charCodeAt(0))));
|
|
5555
5554
|
}
|
|
5556
5555
|
writeEBML(data) {
|
|
@@ -5588,7 +5587,7 @@ var Mediabunny = (() => {
|
|
|
5588
5587
|
this.writeUnsignedInt(data.data, size);
|
|
5589
5588
|
} else if (typeof data.data === "string") {
|
|
5590
5589
|
this.writeVarInt(data.data.length);
|
|
5591
|
-
this.
|
|
5590
|
+
this.writeAsciiString(data.data);
|
|
5592
5591
|
} else if (data.data instanceof Uint8Array) {
|
|
5593
5592
|
this.writeVarInt(data.data.byteLength, data.size);
|
|
5594
5593
|
this.writer.write(data.data);
|
|
@@ -5690,7 +5689,7 @@ var Mediabunny = (() => {
|
|
|
5690
5689
|
this.pos += width;
|
|
5691
5690
|
return value;
|
|
5692
5691
|
}
|
|
5693
|
-
|
|
5692
|
+
readAsciiString(length) {
|
|
5694
5693
|
const { view: view2, offset } = this.reader.getViewAndOffset(this.pos, this.pos + length);
|
|
5695
5694
|
this.pos += length;
|
|
5696
5695
|
let strLength = 0;
|
|
@@ -12130,7 +12129,9 @@ ${cue.notes ?? ""}`;
|
|
|
12130
12129
|
super();
|
|
12131
12130
|
/** @internal */
|
|
12132
12131
|
this._fullData = null;
|
|
12133
|
-
|
|
12132
|
+
/** @internal */
|
|
12133
|
+
this._nextUrlVersion = null;
|
|
12134
|
+
this._url = url2 instanceof URL ? url2 : new URL(url2);
|
|
12134
12135
|
this._options = options;
|
|
12135
12136
|
}
|
|
12136
12137
|
/** @internal */
|
|
@@ -12139,6 +12140,10 @@ ${cue.notes ?? ""}`;
|
|
|
12139
12140
|
if (range) {
|
|
12140
12141
|
headers["Range"] = `bytes=${range.start}-${range.end - 1}`;
|
|
12141
12142
|
}
|
|
12143
|
+
if (this._nextUrlVersion !== null) {
|
|
12144
|
+
this._url.searchParams.set("mediabunny_version", this._nextUrlVersion.toString());
|
|
12145
|
+
this._nextUrlVersion++;
|
|
12146
|
+
}
|
|
12142
12147
|
const response = await retriedFetch(
|
|
12143
12148
|
this._url,
|
|
12144
12149
|
mergeObjectsDeeply(this._options.requestInit ?? {}, {
|
|
@@ -12151,6 +12156,10 @@ ${cue.notes ?? ""}`;
|
|
|
12151
12156
|
throw new Error(`Error fetching ${this._url}: ${response.status} ${response.statusText}`);
|
|
12152
12157
|
}
|
|
12153
12158
|
const buffer = await response.arrayBuffer();
|
|
12159
|
+
if (response.status === 206 && range && buffer.byteLength !== range.end - range.start && this._nextUrlVersion === null) {
|
|
12160
|
+
this._nextUrlVersion = 1;
|
|
12161
|
+
return this._makeRequest(range);
|
|
12162
|
+
}
|
|
12154
12163
|
if (response.status === 200) {
|
|
12155
12164
|
this._fullData = buffer;
|
|
12156
12165
|
}
|
|
@@ -14642,7 +14651,7 @@ ${cue.notes ?? ""}`;
|
|
|
14642
14651
|
switch (id) {
|
|
14643
14652
|
case 17026 /* DocType */:
|
|
14644
14653
|
{
|
|
14645
|
-
this.isWebM = reader.
|
|
14654
|
+
this.isWebM = reader.readAsciiString(size) === "webm";
|
|
14646
14655
|
}
|
|
14647
14656
|
;
|
|
14648
14657
|
break;
|
|
@@ -14840,7 +14849,7 @@ ${cue.notes ?? ""}`;
|
|
|
14840
14849
|
case 134 /* CodecID */:
|
|
14841
14850
|
{
|
|
14842
14851
|
if (!this.currentTrack) break;
|
|
14843
|
-
this.currentTrack.codecId = reader.
|
|
14852
|
+
this.currentTrack.codecId = reader.readAsciiString(size);
|
|
14844
14853
|
}
|
|
14845
14854
|
;
|
|
14846
14855
|
break;
|
|
@@ -14861,7 +14870,7 @@ ${cue.notes ?? ""}`;
|
|
|
14861
14870
|
case 2274716 /* Language */:
|
|
14862
14871
|
{
|
|
14863
14872
|
if (!this.currentTrack) break;
|
|
14864
|
-
this.currentTrack.languageCode = reader.
|
|
14873
|
+
this.currentTrack.languageCode = reader.readAsciiString(size);
|
|
14865
14874
|
if (!isIso639Dash2LanguageCode(this.currentTrack.languageCode)) {
|
|
14866
14875
|
this.currentTrack.languageCode = UNDETERMINED_LANGUAGE;
|
|
14867
14876
|
}
|
|
@@ -16669,7 +16678,7 @@ ${cue.notes ?? ""}`;
|
|
|
16669
16678
|
break;
|
|
16670
16679
|
case 17026 /* DocType */:
|
|
16671
16680
|
{
|
|
16672
|
-
const docType = ebmlReader.
|
|
16681
|
+
const docType = ebmlReader.readAsciiString(size);
|
|
16673
16682
|
if (docType !== desiredDocType) {
|
|
16674
16683
|
return false;
|
|
16675
16684
|
}
|