@remotion/media-parser 4.0.270 → 4.0.271
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/aac-codecprivate.js +6 -13
- package/dist/add-avc-profile-to-track.js +5 -9
- package/dist/buffer-iterator.js +8 -13
- package/dist/combine-uint8-arrays.js +1 -5
- package/dist/containers/aac/parse-aac.js +9 -13
- package/dist/containers/aac/types.js +1 -2
- package/dist/containers/avc/codec-string.js +1 -5
- package/dist/containers/avc/color.js +3 -9
- package/dist/containers/avc/create-sps-pps-data.js +5 -9
- package/dist/containers/avc/interpret-sps.js +7 -13
- package/dist/containers/avc/key.js +1 -5
- package/dist/containers/avc/parse-avc.js +3 -7
- package/dist/containers/avc/sps-and-pps.js +1 -5
- package/dist/containers/flac/get-block-size.js +1 -5
- package/dist/containers/flac/get-channel-count.js +1 -5
- package/dist/containers/flac/get-duration-from-flac.js +1 -5
- package/dist/containers/flac/get-metadata-from-flac.js +1 -5
- package/dist/containers/flac/get-sample-rate.js +1 -5
- package/dist/containers/flac/parse-flac-frame.js +14 -19
- package/dist/containers/flac/parse-flac.js +15 -19
- package/dist/containers/flac/parse-header.js +1 -5
- package/dist/containers/flac/parse-metadata.js +1 -5
- package/dist/containers/flac/parse-streaminfo.js +3 -7
- package/dist/containers/flac/parse-unknown-block.js +1 -5
- package/dist/containers/flac/types.d.ts +2 -2
- package/dist/containers/flac/types.js +1 -2
- package/dist/containers/iso-base-media/base-media-box.js +1 -2
- package/dist/containers/iso-base-media/base-type.js +1 -2
- package/dist/containers/iso-base-media/esds/decoder-specific-config.js +1 -5
- package/dist/containers/iso-base-media/esds/esds-descriptors.js +5 -10
- package/dist/containers/iso-base-media/esds/esds.js +3 -7
- package/dist/containers/iso-base-media/ftyp.js +1 -5
- package/dist/containers/iso-base-media/get-actual-number-of-channels.js +4 -8
- package/dist/containers/iso-base-media/get-children.js +3 -7
- package/dist/containers/iso-base-media/get-keyframes.js +7 -11
- package/dist/containers/iso-base-media/get-moov-atom.js +21 -15
- package/dist/containers/iso-base-media/get-sample-positions-from-track.js +20 -24
- package/dist/containers/iso-base-media/get-video-codec-from-iso-track.d.ts +1 -1
- package/dist/containers/iso-base-media/get-video-codec-from-iso-track.js +3 -7
- package/dist/containers/iso-base-media/make-track.js +30 -34
- package/dist/containers/iso-base-media/mdat/mdat.js +16 -20
- package/dist/containers/iso-base-media/mdhd.js +1 -5
- package/dist/containers/iso-base-media/meta/hdlr.js +1 -5
- package/dist/containers/iso-base-media/meta/ilst.js +1 -5
- package/dist/containers/iso-base-media/moov/moov.js +3 -7
- package/dist/containers/iso-base-media/mvhd.js +7 -11
- package/dist/containers/iso-base-media/parse-boxes.js +5 -9
- package/dist/containers/iso-base-media/parse-icc-profile.js +4 -8
- package/dist/containers/iso-base-media/process-box.js +63 -67
- package/dist/containers/iso-base-media/stsd/av1c.js +1 -5
- package/dist/containers/iso-base-media/stsd/avcc.js +1 -5
- package/dist/containers/iso-base-media/stsd/colr.js +3 -7
- package/dist/containers/iso-base-media/stsd/ctts.js +1 -5
- package/dist/containers/iso-base-media/stsd/hvcc.js +3 -7
- package/dist/containers/iso-base-media/stsd/keys.js +1 -5
- package/dist/containers/iso-base-media/stsd/mebx.js +3 -7
- package/dist/containers/iso-base-media/stsd/pasp.js +1 -5
- package/dist/containers/iso-base-media/stsd/samples.js +8 -13
- package/dist/containers/iso-base-media/stsd/stco.js +1 -5
- package/dist/containers/iso-base-media/stsd/stsc.js +1 -5
- package/dist/containers/iso-base-media/stsd/stsd.js +3 -7
- package/dist/containers/iso-base-media/stsd/stss.js +1 -5
- package/dist/containers/iso-base-media/stsd/stsz.js +1 -5
- package/dist/containers/iso-base-media/stsd/stts.js +1 -5
- package/dist/containers/iso-base-media/tfdt.js +1 -5
- package/dist/containers/iso-base-media/tfhd.js +1 -5
- package/dist/containers/iso-base-media/tkhd.js +4 -8
- package/dist/containers/iso-base-media/to-date.js +1 -5
- package/dist/containers/iso-base-media/trak/trak.js +3 -7
- package/dist/containers/iso-base-media/traversal.d.ts +3 -2
- package/dist/containers/iso-base-media/traversal.js +42 -57
- package/dist/containers/iso-base-media/trun.js +2 -6
- package/dist/containers/iso-base-media/void-box.js +1 -2
- package/dist/containers/m3u/after-manifest-fetch.d.ts +5 -3
- package/dist/containers/m3u/after-manifest-fetch.js +13 -17
- package/dist/containers/m3u/fetch-m3u8-stream.d.ts +5 -1
- package/dist/containers/m3u/fetch-m3u8-stream.js +4 -12
- package/dist/containers/m3u/get-chunks.d.ts +1 -0
- package/dist/containers/m3u/get-chunks.js +6 -6
- package/dist/containers/m3u/get-duration-from-m3u.js +4 -8
- package/dist/containers/m3u/get-playlist.js +6 -12
- package/dist/containers/m3u/get-streams.d.ts +11 -5
- package/dist/containers/m3u/get-streams.js +5 -15
- package/dist/containers/m3u/iterate-over-segment-files.d.ts +19 -0
- package/dist/containers/m3u/iterate-over-segment-files.js +106 -0
- package/dist/containers/m3u/parse-directive.js +10 -10
- package/dist/containers/m3u/parse-m3u-manifest.js +3 -7
- package/dist/containers/m3u/parse-m3u-media-directive.d.ts +1 -0
- package/dist/containers/m3u/parse-m3u-media-directive.js +7 -7
- package/dist/containers/m3u/parse-m3u.js +13 -13
- package/dist/containers/m3u/parse-m3u8-text.js +3 -7
- package/dist/containers/m3u/parse-stream-inf.js +2 -7
- package/dist/containers/m3u/return-packets.d.ts +1 -1
- package/dist/containers/m3u/return-packets.js +14 -5
- package/dist/containers/m3u/run-over-m3u.js +10 -13
- package/dist/containers/m3u/sample-sorter.js +4 -8
- package/dist/containers/m3u/select-stream.d.ts +3 -2
- package/dist/containers/m3u/select-stream.js +9 -13
- package/dist/containers/m3u/types.d.ts +1 -1
- package/dist/containers/m3u/types.js +1 -2
- package/dist/containers/mp3/get-duration.js +5 -9
- package/dist/containers/mp3/get-frame-length.js +2 -7
- package/dist/containers/mp3/get-metadata-from-mp3.d.ts +2 -2
- package/dist/containers/mp3/get-metadata-from-mp3.js +1 -5
- package/dist/containers/mp3/id3-v1.js +1 -5
- package/dist/containers/mp3/id3.js +1 -5
- package/dist/containers/mp3/parse-mp3.js +7 -11
- package/dist/containers/mp3/parse-mpeg-header.js +10 -14
- package/dist/containers/mp3/samples-per-mpeg-file.js +1 -5
- package/dist/containers/riff/expect-riff-box.js +11 -15
- package/dist/containers/riff/get-duration.js +7 -12
- package/dist/containers/riff/get-tracks-from-avi.js +20 -28
- package/dist/containers/riff/is-movi.js +1 -5
- package/dist/containers/riff/parse-avih.js +1 -5
- package/dist/containers/riff/parse-isft.js +1 -5
- package/dist/containers/riff/parse-list-box.js +3 -7
- package/dist/containers/riff/parse-movi.js +13 -18
- package/dist/containers/riff/parse-riff-body.js +9 -13
- package/dist/containers/riff/parse-riff-box.js +9 -13
- package/dist/containers/riff/parse-riff-header.js +1 -5
- package/dist/containers/riff/parse-riff.js +5 -9
- package/dist/containers/riff/parse-strf.js +1 -5
- package/dist/containers/riff/parse-strh.js +3 -7
- package/dist/containers/riff/parse-video-section.js +7 -11
- package/dist/containers/riff/riff-box.js +1 -2
- package/dist/containers/riff/timescale.js +1 -4
- package/dist/containers/riff/traversal.js +7 -15
- package/dist/containers/transport-stream/adts-header.js +6 -10
- package/dist/containers/transport-stream/boxes.js +1 -2
- package/dist/containers/transport-stream/discard-rest-of-packet.js +2 -7
- package/dist/containers/transport-stream/find-separator.js +1 -4
- package/dist/containers/transport-stream/get-tracks.js +7 -12
- package/dist/containers/transport-stream/handle-aac-packet.js +12 -16
- package/dist/containers/transport-stream/handle-avc-packet.js +22 -26
- package/dist/containers/transport-stream/next-pes-header-store.js +1 -5
- package/dist/containers/transport-stream/parse-packet.js +13 -17
- package/dist/containers/transport-stream/parse-pat.js +5 -10
- package/dist/containers/transport-stream/parse-pes.js +1 -5
- package/dist/containers/transport-stream/parse-pmt.js +3 -7
- package/dist/containers/transport-stream/parse-stream-packet.js +13 -17
- package/dist/containers/transport-stream/parse-transport-stream.js +5 -9
- package/dist/containers/transport-stream/process-stream-buffers.js +10 -15
- package/dist/containers/transport-stream/traversal.js +4 -10
- package/dist/containers/wav/get-duration-from-wav.js +3 -8
- package/dist/containers/wav/get-metadata-from-wav.d.ts +2 -2
- package/dist/containers/wav/get-metadata-from-wav.js +1 -5
- package/dist/containers/wav/parse-data.js +5 -9
- package/dist/containers/wav/parse-fmt.js +3 -7
- package/dist/containers/wav/parse-header.js +1 -5
- package/dist/containers/wav/parse-id3.js +1 -5
- package/dist/containers/wav/parse-list.js +1 -5
- package/dist/containers/wav/parse-video-section.js +3 -7
- package/dist/containers/wav/parse-wav.js +15 -19
- package/dist/containers/wav/types.d.ts +2 -2
- package/dist/containers/wav/types.js +1 -2
- package/dist/containers/webm/allowed-partial-segments.js +1 -4
- package/dist/containers/webm/av1-codec-private.js +3 -7
- package/dist/containers/webm/color.js +6 -10
- package/dist/containers/webm/description.js +6 -10
- package/dist/containers/webm/get-ready-tracks.js +13 -18
- package/dist/containers/webm/get-sample-from-block.js +12 -16
- package/dist/containers/webm/make-track.js +43 -48
- package/dist/containers/webm/parse-ebml.js +14 -19
- package/dist/containers/webm/parse-webm-header.js +3 -7
- package/dist/containers/webm/segments/all-segments.js +168 -173
- package/dist/containers/webm/segments/block-simple-block-flags.js +4 -8
- package/dist/containers/webm/segments/track-entry.js +1 -5
- package/dist/containers/webm/segments.js +9 -13
- package/dist/containers/webm/traversal.js +37 -67
- package/dist/convert-audio-or-video-sample.js +1 -5
- package/dist/download-and-parse-media.js +44 -47
- package/dist/emit-available-info.js +38 -38
- package/dist/emitter.js +1 -5
- package/dist/errors.d.ts +2 -17
- package/dist/errors.js +10 -30
- package/dist/esm/fetch.mjs +93 -67
- package/dist/esm/index.mjs +679 -175
- package/dist/esm/node.mjs +59 -36
- package/dist/esm/universal.mjs +323 -0
- package/dist/esm/web-file.mjs +55 -43
- package/dist/esm/web.mjs +257 -0
- package/dist/esm/worker-server-entry.mjs +13056 -0
- package/dist/esm/worker-server.mjs +12914 -0
- package/dist/esm/worker-web-entry.mjs +12969 -0
- package/dist/esm/worker.mjs +439 -0
- package/dist/fetch.js +1 -17
- package/dist/file-types/bmp.js +3 -7
- package/dist/file-types/detect-file-type.js +24 -38
- package/dist/file-types/index.js +22 -26
- package/dist/file-types/jpeg.js +4 -9
- package/dist/file-types/pdf.js +3 -7
- package/dist/file-types/png.js +4 -9
- package/dist/file-types/webp.js +3 -7
- package/dist/forward-controller.js +1 -5
- package/dist/get-audio-codec.js +25 -38
- package/dist/get-container.d.ts +3 -3
- package/dist/get-container.js +5 -10
- package/dist/get-dimensions.js +8 -13
- package/dist/get-duration.js +27 -34
- package/dist/get-fields-from-callbacks.js +1 -5
- package/dist/get-fps.js +24 -34
- package/dist/get-is-hdr.js +5 -10
- package/dist/get-keyframes.js +6 -11
- package/dist/get-location.js +4 -9
- package/dist/get-number-of-audio-channels.js +2 -7
- package/dist/get-sample-aspect-ratio.js +17 -30
- package/dist/get-sample-positions-from-lpcm.js +5 -9
- package/dist/get-sample-positions.js +1 -5
- package/dist/get-sample-rate.js +2 -7
- package/dist/get-tracks.d.ts +5 -0
- package/dist/get-tracks.js +37 -44
- package/dist/get-video-codec.js +26 -34
- package/dist/has-all-info.js +33 -38
- package/dist/index.d.ts +15 -11
- package/dist/index.js +34 -48
- package/dist/init-video.d.ts +1 -1
- package/dist/init-video.js +47 -20
- package/dist/internal-parse-media.js +36 -40
- package/dist/is-audio-structure.d.ts +2 -2
- package/dist/is-audio-structure.js +1 -5
- package/dist/log.js +8 -12
- package/dist/make-hvc1-codec-strings.js +1 -5
- package/dist/media-parser-controller.js +7 -11
- package/dist/metadata/get-metadata.d.ts +4 -4
- package/dist/metadata/get-metadata.js +17 -22
- package/dist/metadata/metadata-from-iso.d.ts +3 -3
- package/dist/metadata/metadata-from-iso.js +12 -17
- package/dist/metadata/metadata-from-matroska.d.ts +2 -2
- package/dist/metadata/metadata-from-matroska.js +3 -7
- package/dist/metadata/metadata-from-riff.d.ts +2 -2
- package/dist/metadata/metadata-from-riff.js +3 -7
- package/dist/node-writer.js +1 -17
- package/dist/node.js +1 -17
- package/dist/options.d.ts +30 -24
- package/dist/options.js +1 -2
- package/dist/parse-media-on-browser-worker.d.ts +2 -0
- package/dist/parse-media-on-browser-worker.js +4 -0
- package/dist/parse-media-on-server-worker.d.ts +2 -0
- package/dist/parse-media-on-server-worker.js +4 -0
- package/dist/parse-media-on-web-worker.d.ts +2 -0
- package/dist/parse-media-on-web-worker.js +4 -0
- package/dist/parse-media-on-worker-entry.d.ts +2 -0
- package/dist/parse-media-on-worker-entry.js +269 -0
- package/dist/parse-media-on-worker.d.ts +2 -0
- package/dist/parse-media-on-worker.js +4 -0
- package/dist/parse-media.js +10 -13
- package/dist/parse-result.d.ts +3 -3
- package/dist/parse-result.js +1 -2
- package/dist/pause-signal.js +1 -5
- package/dist/perform-seek.js +6 -10
- package/dist/readers/fetch/get-body-and-reader.js +1 -5
- package/dist/readers/fetch/resolve-url.d.ts +1 -1
- package/dist/readers/fetch/resolve-url.js +1 -5
- package/dist/readers/from-fetch.d.ts +4 -1
- package/dist/readers/from-fetch.js +109 -94
- package/dist/readers/from-node.d.ts +4 -1
- package/dist/readers/from-node.js +58 -41
- package/dist/readers/from-web-file.d.ts +4 -1
- package/dist/readers/from-web-file.js +55 -49
- package/dist/readers/reader.d.ts +5 -1
- package/dist/readers/reader.js +1 -2
- package/dist/readers/universal.d.ts +2 -0
- package/dist/readers/universal.js +35 -0
- package/dist/readers/web.d.ts +2 -0
- package/dist/readers/web.js +22 -0
- package/dist/register-track.js +9 -15
- package/dist/remotion-license-acknowledge.js +4 -8
- package/dist/run-parse-iteration.js +26 -25
- package/dist/samples-from-moof.js +8 -12
- package/dist/skip.js +1 -5
- package/dist/state/aac-state.js +1 -5
- package/dist/state/can-skip-tracks.d.ts +2 -2
- package/dist/state/can-skip-tracks.js +3 -8
- package/dist/state/emitted-fields.js +1 -5
- package/dist/state/flac-state.js +1 -5
- package/dist/state/has-tracks-section.js +3 -7
- package/dist/state/images.js +1 -5
- package/dist/state/iso-base-media/cached-sample-positions.js +8 -13
- package/dist/state/iso-base-media/iso-state.js +5 -9
- package/dist/state/iso-base-media/moov-box.js +1 -5
- package/dist/state/keyframes.js +1 -5
- package/dist/state/last-eventloop-break.js +3 -7
- package/dist/state/m3u-state.d.ts +3 -0
- package/dist/state/m3u-state.js +16 -11
- package/dist/state/may-skip-video-data.js +3 -7
- package/dist/state/mp3.js +1 -5
- package/dist/state/need-samples-for-fields.js +1 -5
- package/dist/state/parser-state.d.ts +12 -10
- package/dist/state/parser-state.js +36 -41
- package/dist/state/riff.js +1 -5
- package/dist/state/sample-callbacks.js +8 -12
- package/dist/state/slow-duration-fps.js +1 -5
- package/dist/state/structure.d.ts +4 -4
- package/dist/state/structure.js +1 -5
- package/dist/state/transport-stream.js +3 -7
- package/dist/state/video-section.js +1 -5
- package/dist/state/webm.js +5 -9
- package/dist/throttled-progress.js +1 -5
- package/dist/truthy.js +1 -4
- package/dist/universal.d.ts +1 -0
- package/dist/universal.js +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -4
- package/dist/web-file.js +1 -17
- package/dist/web.d.ts +1 -0
- package/dist/web.js +1 -0
- package/dist/webcodec-sample-types.d.ts +6 -4
- package/dist/webcodec-sample-types.js +1 -2
- package/dist/worker/forward-controller.d.ts +3 -0
- package/dist/worker/forward-controller.js +20 -0
- package/dist/worker/serialize-error.d.ts +4 -0
- package/dist/worker/serialize-error.js +95 -0
- package/dist/worker/worker-types.d.ts +243 -0
- package/dist/worker/worker-types.js +1 -0
- package/dist/worker-bun-entry.d.ts +1 -0
- package/dist/worker-bun-entry.js +5 -0
- package/dist/worker-entry.d.ts +1 -0
- package/dist/worker-entry.js +5 -0
- package/dist/worker-server-entry.d.ts +1 -0
- package/dist/worker-server-entry.js +5 -0
- package/dist/worker-server.d.ts +2 -0
- package/dist/worker-server.js +381 -0
- package/dist/worker-web-entry.d.ts +1 -0
- package/dist/worker-web-entry.js +5 -0
- package/dist/worker.d.ts +2 -0
- package/dist/worker.js +267 -0
- package/dist/writers/node.js +16 -23
- package/dist/writers/writer.js +1 -2
- package/package.json +40 -21
- package/fetch.js +0 -2
- package/test.json +0 -663
- package/web-file.js +0 -2
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchReader = void 0;
|
|
4
|
-
exports.parseContentRange = parseContentRange;
|
|
5
1
|
/* eslint-disable eqeqeq */
|
|
6
2
|
/* eslint-disable no-eq-null */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
import { MediaParserAbortError } from '../errors';
|
|
4
|
+
import { getLengthAndReader } from './fetch/get-body-and-reader';
|
|
5
|
+
import { resolveUrl } from './fetch/resolve-url';
|
|
10
6
|
/**
|
|
11
7
|
* Parse Content-Range header.
|
|
12
8
|
* From: https://github.com/gregberge/content-range/blob/main/src/index.ts
|
|
13
9
|
*/
|
|
14
|
-
function parseContentRange(input) {
|
|
10
|
+
export function parseContentRange(input) {
|
|
15
11
|
const matches = input.match(/^(\w+) ((\d+)-(\d+)|\*)\/(\d+|\*)$/);
|
|
16
12
|
if (!matches)
|
|
17
13
|
return null;
|
|
@@ -27,101 +23,120 @@ function parseContentRange(input) {
|
|
|
27
23
|
}
|
|
28
24
|
return range;
|
|
29
25
|
}
|
|
30
|
-
const validateContentRangeAndDetectIfSupported = ({
|
|
26
|
+
const validateContentRangeAndDetectIfSupported = ({ requestedRange, parsedContentRange, statusCode, }) => {
|
|
31
27
|
if (statusCode === 206) {
|
|
32
28
|
return { supportsContentRange: true };
|
|
33
29
|
}
|
|
34
|
-
if (typeof
|
|
35
|
-
(parsedContentRange === null || parsedContentRange === void 0 ? void 0 : parsedContentRange.start) !==
|
|
36
|
-
if (
|
|
30
|
+
if (typeof requestedRange === 'number' &&
|
|
31
|
+
(parsedContentRange === null || parsedContentRange === void 0 ? void 0 : parsedContentRange.start) !== requestedRange) {
|
|
32
|
+
if (requestedRange === 0) {
|
|
37
33
|
return { supportsContentRange: false };
|
|
38
34
|
}
|
|
39
|
-
throw new Error(`Range header (${
|
|
35
|
+
throw new Error(`Range header (${requestedRange}) does not match content-range header (${parsedContentRange === null || parsedContentRange === void 0 ? void 0 : parsedContentRange.start})`);
|
|
40
36
|
}
|
|
41
|
-
if (
|
|
42
|
-
typeof
|
|
43
|
-
((parsedContentRange === null || parsedContentRange === void 0 ? void 0 : parsedContentRange.start) !==
|
|
44
|
-
(parsedContentRange === null || parsedContentRange === void 0 ? void 0 : parsedContentRange.end) !==
|
|
45
|
-
throw new Error(`Range header (${
|
|
37
|
+
if (requestedRange !== null &&
|
|
38
|
+
typeof requestedRange !== 'number' &&
|
|
39
|
+
((parsedContentRange === null || parsedContentRange === void 0 ? void 0 : parsedContentRange.start) !== requestedRange[0] ||
|
|
40
|
+
(parsedContentRange === null || parsedContentRange === void 0 ? void 0 : parsedContentRange.end) !== requestedRange[1])) {
|
|
41
|
+
throw new Error(`Range header (${requestedRange}) does not match content-range header (${parsedContentRange === null || parsedContentRange === void 0 ? void 0 : parsedContentRange.start})`);
|
|
46
42
|
}
|
|
47
43
|
return { supportsContentRange: true };
|
|
48
44
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
: {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
45
|
+
export const fetchReadContent = async ({ src, range, controller, }) => {
|
|
46
|
+
var _a;
|
|
47
|
+
if (typeof src !== 'string' && src instanceof URL === false) {
|
|
48
|
+
throw new Error('src must be a string when using `fetchReader`');
|
|
49
|
+
}
|
|
50
|
+
const resolvedUrl = resolveUrl(src);
|
|
51
|
+
const resolvedUrlString = resolvedUrl.toString();
|
|
52
|
+
if (!resolvedUrlString.startsWith('https://') &&
|
|
53
|
+
!resolvedUrlString.startsWith('blob:') &&
|
|
54
|
+
!resolvedUrlString.startsWith('http://')) {
|
|
55
|
+
return Promise.reject(new Error(`${resolvedUrlString} is not a URL - needs to start with http:// or https:// or blob:. If you want to read a local file, pass \`reader: nodeReader\` to parseMedia().`));
|
|
56
|
+
}
|
|
57
|
+
const ownController = new AbortController();
|
|
58
|
+
const cache = typeof navigator !== 'undefined' &&
|
|
59
|
+
navigator.userAgent.includes('Cloudflare-Workers')
|
|
60
|
+
? undefined
|
|
61
|
+
: // Disable Next.js caching
|
|
62
|
+
'no-store';
|
|
63
|
+
const requestedRange = range === null ? 0 : range;
|
|
64
|
+
const asString = typeof resolvedUrl === 'string' ? resolvedUrl : resolvedUrl.pathname;
|
|
65
|
+
const requestWithoutRange = asString.endsWith('.m3u8');
|
|
66
|
+
const canLiveWithoutContentLength = asString.endsWith('.m3u8') || asString.endsWith('.ts');
|
|
67
|
+
const headers = requestedRange === 0 && requestWithoutRange
|
|
68
|
+
? {}
|
|
69
|
+
: typeof requestedRange === 'number'
|
|
70
|
+
? {
|
|
71
|
+
Range: `bytes=${requestedRange}-`,
|
|
72
|
+
}
|
|
73
|
+
: {
|
|
74
|
+
Range: `bytes=${`${requestedRange[0]}-${requestedRange[1]}`}`,
|
|
75
|
+
};
|
|
76
|
+
const res = await fetch(resolvedUrl, {
|
|
77
|
+
headers,
|
|
78
|
+
signal: ownController.signal,
|
|
79
|
+
cache,
|
|
80
|
+
});
|
|
81
|
+
const contentRange = res.headers.get('content-range');
|
|
82
|
+
const parsedContentRange = contentRange
|
|
83
|
+
? parseContentRange(contentRange)
|
|
84
|
+
: null;
|
|
85
|
+
const { supportsContentRange } = validateContentRangeAndDetectIfSupported({
|
|
86
|
+
requestedRange,
|
|
87
|
+
parsedContentRange,
|
|
88
|
+
statusCode: res.status,
|
|
89
|
+
});
|
|
90
|
+
controller._internals.signal.addEventListener('abort', () => {
|
|
91
|
+
ownController.abort(new MediaParserAbortError('Aborted by user'));
|
|
92
|
+
}, { once: true });
|
|
93
|
+
if (res.status.toString().startsWith('4') ||
|
|
94
|
+
res.status.toString().startsWith('5')) {
|
|
95
|
+
throw new Error(`Server returned status code ${res.status} for ${src} and range ${requestedRange}`);
|
|
96
|
+
}
|
|
97
|
+
const contentDisposition = res.headers.get('content-disposition');
|
|
98
|
+
const name = (_a = contentDisposition === null || contentDisposition === void 0 ? void 0 : contentDisposition.match(/filename="([^"]+)"/)) === null || _a === void 0 ? void 0 : _a[1];
|
|
99
|
+
const fallbackName = src.toString().split('/').pop();
|
|
100
|
+
const { contentLength, needsContentRange, reader } = await getLengthAndReader({
|
|
101
|
+
canLiveWithoutContentLength,
|
|
102
|
+
res,
|
|
103
|
+
ownController,
|
|
104
|
+
requestedWithoutRange: requestWithoutRange,
|
|
105
|
+
});
|
|
106
|
+
if (controller) {
|
|
95
107
|
controller._internals.signal.addEventListener('abort', () => {
|
|
96
|
-
|
|
108
|
+
reader.reader.cancel().catch(() => {
|
|
109
|
+
// Prevent unhandled rejection in Firefox
|
|
110
|
+
});
|
|
97
111
|
}, { once: true });
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
reader,
|
|
115
|
+
contentLength,
|
|
116
|
+
contentType: res.headers.get('content-type'),
|
|
117
|
+
name: name !== null && name !== void 0 ? name : fallbackName,
|
|
118
|
+
supportsContentRange,
|
|
119
|
+
needsContentRange,
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
export const fetchReadWholeAsText = async (src) => {
|
|
123
|
+
if (typeof src !== 'string' && src instanceof URL === false) {
|
|
124
|
+
throw new Error('src must be a string when using `fetchReader`');
|
|
125
|
+
}
|
|
126
|
+
const res = await fetch(src);
|
|
127
|
+
if (!res.ok) {
|
|
128
|
+
throw new Error(`Failed to fetch ${src} (HTTP code: ${res.status})`);
|
|
129
|
+
}
|
|
130
|
+
return res.text();
|
|
131
|
+
};
|
|
132
|
+
export const fetchCreateAdjacentFileSource = (relativePath, src) => {
|
|
133
|
+
if (typeof src !== 'string' && src instanceof URL === false) {
|
|
134
|
+
throw new Error('src must be a string or URL when using `fetchReader`');
|
|
135
|
+
}
|
|
136
|
+
return new URL(relativePath, src).toString();
|
|
137
|
+
};
|
|
138
|
+
export const fetchReader = {
|
|
139
|
+
read: fetchReadContent,
|
|
140
|
+
readWholeAsText: fetchReadWholeAsText,
|
|
141
|
+
createAdjacentFileSource: fetchCreateAdjacentFileSource,
|
|
127
142
|
};
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import type { ReaderInterface } from './reader';
|
|
1
|
+
import type { CreateAdjacentFileSource, ReadContent, ReadWholeAsText, ReaderInterface } from './reader';
|
|
2
|
+
export declare const nodeReadContent: ReadContent;
|
|
3
|
+
export declare const nodeReadWholeAsText: ReadWholeAsText;
|
|
4
|
+
export declare const nodeCreateAdjacentFileSource: CreateAdjacentFileSource;
|
|
2
5
|
export declare const nodeReader: ReaderInterface;
|
|
@@ -1,46 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
start: range === null ? 0 : typeof range === 'number' ? range : range[0],
|
|
15
|
-
end: range === null
|
|
1
|
+
import { createReadStream, promises, statSync } from 'fs';
|
|
2
|
+
import { dirname, join, relative, sep } from 'path';
|
|
3
|
+
import { Readable } from 'stream';
|
|
4
|
+
export const nodeReadContent = ({ src, range, controller }) => {
|
|
5
|
+
if (typeof src !== 'string') {
|
|
6
|
+
throw new Error('src must be a string when using `nodeReader`');
|
|
7
|
+
}
|
|
8
|
+
const ownController = new AbortController();
|
|
9
|
+
const stream = createReadStream(src, {
|
|
10
|
+
start: range === null ? 0 : typeof range === 'number' ? range : range[0],
|
|
11
|
+
end: range === null
|
|
12
|
+
? Infinity
|
|
13
|
+
: typeof range === 'number'
|
|
16
14
|
? Infinity
|
|
17
|
-
:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
: range[1],
|
|
16
|
+
signal: ownController.signal,
|
|
17
|
+
});
|
|
18
|
+
controller._internals.signal.addEventListener('abort', () => {
|
|
19
|
+
ownController.abort();
|
|
20
|
+
}, { once: true });
|
|
21
|
+
const stats = statSync(src);
|
|
22
|
+
const reader = Readable.toWeb(stream).getReader();
|
|
23
|
+
if (controller) {
|
|
22
24
|
controller._internals.signal.addEventListener('abort', () => {
|
|
23
|
-
|
|
25
|
+
reader.cancel().catch(() => { });
|
|
24
26
|
}, { once: true });
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
return Promise.resolve({
|
|
33
|
-
reader: {
|
|
34
|
-
reader,
|
|
35
|
-
abort: () => {
|
|
36
|
-
ownController.abort();
|
|
37
|
-
},
|
|
27
|
+
}
|
|
28
|
+
return Promise.resolve({
|
|
29
|
+
reader: {
|
|
30
|
+
reader,
|
|
31
|
+
abort: () => {
|
|
32
|
+
ownController.abort();
|
|
38
33
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
34
|
+
},
|
|
35
|
+
contentLength: stats.size,
|
|
36
|
+
contentType: null,
|
|
37
|
+
name: src.split(sep).pop(),
|
|
38
|
+
supportsContentRange: true,
|
|
39
|
+
needsContentRange: true,
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
export const nodeReadWholeAsText = (src) => {
|
|
43
|
+
if (typeof src !== 'string') {
|
|
44
|
+
throw new Error('src must be a string when using `nodeReader`');
|
|
45
|
+
}
|
|
46
|
+
return promises.readFile(src, 'utf8');
|
|
47
|
+
};
|
|
48
|
+
export const nodeCreateAdjacentFileSource = (relativePath, src) => {
|
|
49
|
+
if (typeof src !== 'string') {
|
|
50
|
+
throw new Error('src must be a string when using `nodeReader`');
|
|
51
|
+
}
|
|
52
|
+
const result = join(dirname(src), relativePath);
|
|
53
|
+
const rel = relative(dirname(src), result);
|
|
54
|
+
if (rel.startsWith('..')) {
|
|
55
|
+
throw new Error('Path is outside of the parent directory - not allowing reading of arbitrary files');
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
};
|
|
59
|
+
export const nodeReader = {
|
|
60
|
+
read: nodeReadContent,
|
|
61
|
+
readWholeAsText: nodeReadWholeAsText,
|
|
62
|
+
createAdjacentFileSource: nodeCreateAdjacentFileSource,
|
|
46
63
|
};
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import type { ReaderInterface } from './reader';
|
|
1
|
+
import type { CreateAdjacentFileSource, ReadContent, ReaderInterface, ReadWholeAsText } from './reader';
|
|
2
|
+
export declare const webFileReadContent: ReadContent;
|
|
3
|
+
export declare const webFileReadWholeAsText: ReadWholeAsText;
|
|
4
|
+
export declare const webFileCreateAdjacentFileSource: CreateAdjacentFileSource;
|
|
2
5
|
export declare const webFileReader: ReaderInterface;
|
|
@@ -1,51 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
reader: streamReader,
|
|
34
|
-
abort() {
|
|
35
|
-
streamReader.cancel();
|
|
36
|
-
ownController.abort();
|
|
37
|
-
},
|
|
1
|
+
export const webFileReadContent = ({ src, range, controller }) => {
|
|
2
|
+
if (typeof src === 'string' || src instanceof URL) {
|
|
3
|
+
throw new Error('`inputTypeFileReader` only supports `File` objects');
|
|
4
|
+
}
|
|
5
|
+
const part = range === null
|
|
6
|
+
? src
|
|
7
|
+
: typeof range === 'number'
|
|
8
|
+
? src.slice(range)
|
|
9
|
+
: src.slice(range[0], range[1]);
|
|
10
|
+
const reader = new FileReader();
|
|
11
|
+
reader.readAsArrayBuffer(src);
|
|
12
|
+
const ownController = new AbortController();
|
|
13
|
+
if (ownController) {
|
|
14
|
+
ownController.signal.addEventListener('abort', () => {
|
|
15
|
+
reader.abort();
|
|
16
|
+
}, { once: true });
|
|
17
|
+
}
|
|
18
|
+
if (controller) {
|
|
19
|
+
controller._internals.signal.addEventListener('abort', () => {
|
|
20
|
+
ownController.abort();
|
|
21
|
+
}, { once: true });
|
|
22
|
+
}
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
reader.onload = () => {
|
|
25
|
+
const stream = part.stream();
|
|
26
|
+
const streamReader = stream.getReader();
|
|
27
|
+
resolve({
|
|
28
|
+
reader: {
|
|
29
|
+
reader: streamReader,
|
|
30
|
+
abort() {
|
|
31
|
+
streamReader.cancel();
|
|
32
|
+
ownController.abort();
|
|
38
33
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
}
|
|
34
|
+
},
|
|
35
|
+
contentLength: src.size,
|
|
36
|
+
name: src.name,
|
|
37
|
+
supportsContentRange: true,
|
|
38
|
+
contentType: src.type,
|
|
39
|
+
needsContentRange: true,
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
reader.onerror = () => {
|
|
43
|
+
reject(reader.error);
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
export const webFileReadWholeAsText = () => {
|
|
48
|
+
throw new Error('`webFileReader` cannot read auxiliary files.');
|
|
49
|
+
};
|
|
50
|
+
export const webFileCreateAdjacentFileSource = () => {
|
|
51
|
+
throw new Error('`webFileReader` cannot create adjacent file sources.');
|
|
52
|
+
};
|
|
53
|
+
export const webFileReader = {
|
|
54
|
+
read: webFileReadContent,
|
|
55
|
+
readWholeAsText: webFileReadWholeAsText,
|
|
56
|
+
createAdjacentFileSource: webFileCreateAdjacentFileSource,
|
|
51
57
|
};
|
package/dist/readers/reader.d.ts
CHANGED
|
@@ -12,12 +12,16 @@ type ReadResult = {
|
|
|
12
12
|
supportsContentRange: boolean;
|
|
13
13
|
needsContentRange: boolean;
|
|
14
14
|
};
|
|
15
|
-
type ReadContent = (options: {
|
|
15
|
+
export type ReadContent = (options: {
|
|
16
16
|
src: ParseMediaSrc;
|
|
17
17
|
range: [number, number] | number | null;
|
|
18
18
|
controller: MediaParserController;
|
|
19
19
|
}) => Promise<ReadResult>;
|
|
20
|
+
export type ReadWholeAsText = (src: ParseMediaSrc) => Promise<string>;
|
|
21
|
+
export type CreateAdjacentFileSource = (relativePath: string, src: ParseMediaSrc) => string;
|
|
20
22
|
export type ReaderInterface = {
|
|
21
23
|
read: ReadContent;
|
|
24
|
+
readWholeAsText: ReadWholeAsText;
|
|
25
|
+
createAdjacentFileSource: CreateAdjacentFileSource;
|
|
22
26
|
};
|
|
23
27
|
export {};
|
package/dist/readers/reader.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { fetchCreateAdjacentFileSource, fetchReadContent, fetchReadWholeAsText, } from './from-fetch';
|
|
2
|
+
import { nodeCreateAdjacentFileSource, nodeReadContent, nodeReadWholeAsText, } from './from-node';
|
|
3
|
+
import { webFileCreateAdjacentFileSource, webFileReadContent, webFileReadWholeAsText, } from './from-web-file';
|
|
4
|
+
export const universalReader = {
|
|
5
|
+
read: (params) => {
|
|
6
|
+
if (params.src instanceof Blob) {
|
|
7
|
+
return webFileReadContent(params);
|
|
8
|
+
}
|
|
9
|
+
if (params.src.toString().startsWith('http') ||
|
|
10
|
+
params.src.toString().startsWith('blob:')) {
|
|
11
|
+
return fetchReadContent(params);
|
|
12
|
+
}
|
|
13
|
+
return nodeReadContent(params);
|
|
14
|
+
},
|
|
15
|
+
readWholeAsText: (src) => {
|
|
16
|
+
if (src instanceof Blob) {
|
|
17
|
+
return webFileReadWholeAsText(src);
|
|
18
|
+
}
|
|
19
|
+
if (src.toString().startsWith('http') ||
|
|
20
|
+
src.toString().startsWith('blob:')) {
|
|
21
|
+
return fetchReadWholeAsText(src);
|
|
22
|
+
}
|
|
23
|
+
return nodeReadWholeAsText(src);
|
|
24
|
+
},
|
|
25
|
+
createAdjacentFileSource: (relativePath, src) => {
|
|
26
|
+
if (src instanceof Blob) {
|
|
27
|
+
return webFileCreateAdjacentFileSource(relativePath, src);
|
|
28
|
+
}
|
|
29
|
+
if (src.toString().startsWith('http') ||
|
|
30
|
+
src.toString().startsWith('blob:')) {
|
|
31
|
+
return fetchCreateAdjacentFileSource(relativePath, src);
|
|
32
|
+
}
|
|
33
|
+
return nodeCreateAdjacentFileSource(relativePath, src);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { fetchCreateAdjacentFileSource, fetchReadContent, fetchReadWholeAsText, } from './from-fetch';
|
|
2
|
+
import { webFileCreateAdjacentFileSource, webFileReadContent, webFileReadWholeAsText, } from './from-web-file';
|
|
3
|
+
export const webReader = {
|
|
4
|
+
read: (params) => {
|
|
5
|
+
if (params.src instanceof Blob) {
|
|
6
|
+
return webFileReadContent(params);
|
|
7
|
+
}
|
|
8
|
+
return fetchReadContent(params);
|
|
9
|
+
},
|
|
10
|
+
createAdjacentFileSource: (relativePath, src) => {
|
|
11
|
+
if (src instanceof Blob) {
|
|
12
|
+
return webFileCreateAdjacentFileSource(relativePath, src);
|
|
13
|
+
}
|
|
14
|
+
return fetchCreateAdjacentFileSource(relativePath, src);
|
|
15
|
+
},
|
|
16
|
+
readWholeAsText: (src) => {
|
|
17
|
+
if (src instanceof Blob) {
|
|
18
|
+
return webFileReadWholeAsText(src);
|
|
19
|
+
}
|
|
20
|
+
return fetchReadWholeAsText(src);
|
|
21
|
+
},
|
|
22
|
+
};
|
package/dist/register-track.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const add_avc_profile_to_track_1 = require("./add-avc-profile-to-track");
|
|
5
|
-
const log_1 = require("./log");
|
|
6
|
-
const registerVideoTrack = async ({ state, track, container, }) => {
|
|
1
|
+
import { addAvcProfileToTrack } from './add-avc-profile-to-track';
|
|
2
|
+
import { Log } from './log';
|
|
3
|
+
export const registerVideoTrack = async ({ state, track, container, }) => {
|
|
7
4
|
if (state.callbacks.tracks.getTracks().find((t) => t.trackId === track.trackId)) {
|
|
8
|
-
|
|
5
|
+
Log.trace(state.logLevel, `Track ${track.trackId} already registered, skipping`);
|
|
9
6
|
return null;
|
|
10
7
|
}
|
|
11
8
|
if (track.type !== 'video') {
|
|
@@ -19,10 +16,9 @@ const registerVideoTrack = async ({ state, track, container, }) => {
|
|
|
19
16
|
await state.callbacks.registerVideoSampleCallback(track.trackId, callback !== null && callback !== void 0 ? callback : null);
|
|
20
17
|
return callback;
|
|
21
18
|
};
|
|
22
|
-
|
|
23
|
-
const registerAudioTrack = async ({ state, track, container, }) => {
|
|
19
|
+
export const registerAudioTrack = async ({ state, track, container, }) => {
|
|
24
20
|
if (state.callbacks.tracks.getTracks().find((t) => t.trackId === track.trackId)) {
|
|
25
|
-
|
|
21
|
+
Log.trace(state.logLevel, `Track ${track.trackId} already registered, skipping`);
|
|
26
22
|
return null;
|
|
27
23
|
}
|
|
28
24
|
if (track.type !== 'audio') {
|
|
@@ -36,14 +32,12 @@ const registerAudioTrack = async ({ state, track, container, }) => {
|
|
|
36
32
|
await state.callbacks.registerAudioSampleCallback(track.trackId, callback !== null && callback !== void 0 ? callback : null);
|
|
37
33
|
return callback;
|
|
38
34
|
};
|
|
39
|
-
|
|
40
|
-
const registerVideoTrackWhenProfileIsAvailable = ({ state, track, container, }) => {
|
|
35
|
+
export const registerVideoTrackWhenProfileIsAvailable = ({ state, track, container, }) => {
|
|
41
36
|
state.riff.registerOnAvcProfileCallback(async (profile) => {
|
|
42
|
-
await
|
|
37
|
+
await registerVideoTrack({
|
|
43
38
|
state,
|
|
44
|
-
track:
|
|
39
|
+
track: addAvcProfileToTrack(track, profile),
|
|
45
40
|
container,
|
|
46
41
|
});
|
|
47
42
|
});
|
|
48
43
|
};
|
|
49
|
-
exports.registerVideoTrackWhenProfileIsAvailable = registerVideoTrackWhenProfileIsAvailable;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.warnIfRemotionLicenseNotAcknowledged = void 0;
|
|
4
|
-
const log_1 = require("./log");
|
|
1
|
+
import { Log } from './log';
|
|
5
2
|
let warningShown = false;
|
|
6
|
-
const warnIfRemotionLicenseNotAcknowledged = ({ acknowledgeRemotionLicense, logLevel, apiName, }) => {
|
|
3
|
+
export const warnIfRemotionLicenseNotAcknowledged = ({ acknowledgeRemotionLicense, logLevel, apiName, }) => {
|
|
7
4
|
if (acknowledgeRemotionLicense) {
|
|
8
5
|
return;
|
|
9
6
|
}
|
|
@@ -11,7 +8,6 @@ const warnIfRemotionLicenseNotAcknowledged = ({ acknowledgeRemotionLicense, logL
|
|
|
11
8
|
return;
|
|
12
9
|
}
|
|
13
10
|
warningShown = true;
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
Log.warn(logLevel, 'Note: Some companies are required to obtain a license to use @remotion/media-parser. See: https://remotion.dev/license');
|
|
12
|
+
Log.warn(logLevel, `Pass \`acknowledgeRemotionLicense: true\` to \`${apiName}\` function to make this message disappear.`);
|
|
16
13
|
};
|
|
17
|
-
exports.warnIfRemotionLicenseNotAcknowledged = warnIfRemotionLicenseNotAcknowledged;
|