@remotion/media-parser 4.0.247 → 4.0.249
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/boxes/avc/key.d.ts +1 -1
- package/dist/boxes/iso-base-media/get-children.d.ts +14 -0
- package/dist/boxes/iso-base-media/get-children.js +39 -0
- package/dist/boxes/iso-base-media/mdat/mdat.d.ts +2 -1
- package/dist/boxes/iso-base-media/mdat/mdat.js +10 -1
- package/dist/boxes/iso-base-media/moov/moov.js +2 -3
- package/dist/boxes/iso-base-media/parse-boxes.d.ts +15 -0
- package/dist/boxes/iso-base-media/parse-boxes.js +129 -0
- package/dist/boxes/iso-base-media/parse-mdat-partially.d.ts +12 -0
- package/dist/boxes/iso-base-media/parse-mdat-partially.js +33 -0
- package/dist/boxes/iso-base-media/process-box.d.ts +2 -21
- package/dist/boxes/iso-base-media/process-box.js +53 -270
- package/dist/boxes/iso-base-media/stsd/mebx.js +2 -3
- package/dist/boxes/iso-base-media/stsd/samples.js +5 -9
- package/dist/boxes/iso-base-media/trak/trak.js +2 -3
- package/dist/boxes/mp3/get-duration.d.ts +2 -0
- package/dist/boxes/mp3/get-duration.js +30 -0
- package/dist/boxes/mp3/get-frame-length.d.ts +13 -0
- package/dist/boxes/mp3/get-frame-length.js +33 -0
- package/dist/boxes/mp3/get-metadata-from-mp3.d.ts +3 -0
- package/dist/boxes/mp3/get-metadata-from-mp3.js +8 -0
- package/dist/boxes/mp3/get-tracks-from-mp3.d.ts +4 -0
- package/dist/boxes/mp3/get-tracks-from-mp3.js +25 -0
- package/dist/boxes/mp3/id3-v1.d.ts +2 -0
- package/dist/boxes/mp3/id3-v1.js +12 -0
- package/dist/boxes/mp3/id3-v2.d.ts +0 -0
- package/dist/boxes/mp3/id3-v2.js +1 -0
- package/dist/boxes/mp3/id3.d.ts +8 -0
- package/dist/boxes/mp3/id3.js +78 -0
- package/dist/boxes/mp3/parse-mp3.d.ts +8 -0
- package/dist/boxes/mp3/parse-mp3.js +57 -0
- package/dist/boxes/mp3/parse-mpeg-header.d.ts +6 -0
- package/dist/boxes/mp3/parse-mpeg-header.js +274 -0
- package/dist/boxes/mp3/samples-per-mpeg-file.d.ts +4 -0
- package/dist/boxes/mp3/samples-per-mpeg-file.js +26 -0
- package/dist/boxes/riff/continue-after-riff-result.d.ts +13 -0
- package/dist/boxes/riff/continue-after-riff-result.js +34 -0
- package/dist/boxes/riff/expect-riff-box.d.ts +3 -1
- package/dist/boxes/riff/expect-riff-box.js +4 -3
- package/dist/boxes/riff/parse-box.d.ts +1 -7
- package/dist/boxes/riff/parse-box.js +4 -120
- package/dist/boxes/riff/parse-list-box.d.ts +3 -1
- package/dist/boxes/riff/parse-list-box.js +4 -3
- package/dist/boxes/riff/parse-riff-body.d.ts +11 -0
- package/dist/boxes/riff/parse-riff-body.js +105 -0
- package/dist/boxes/riff/parse-riff-box.d.ts +3 -1
- package/dist/boxes/riff/parse-riff-box.js +2 -2
- package/dist/boxes/transport-stream/parse-transport-stream.js +30 -41
- package/dist/buffer-iterator.d.ts +6 -0
- package/dist/buffer-iterator.js +21 -0
- package/dist/continue-mdat-routine.d.ts +17 -0
- package/dist/continue-mdat-routine.js +92 -0
- package/dist/emit-available-info.js +38 -24
- package/dist/esm/index.mjs +1820 -1046
- package/dist/file-types/detect-file-type.js +4 -2
- package/dist/get-audio-codec.js +1 -1
- package/dist/get-container.js +5 -1
- package/dist/get-dimensions.d.ts +1 -1
- package/dist/get-dimensions.js +3 -0
- package/dist/get-duration.js +5 -1
- package/dist/get-fields-from-callbacks.js +1 -0
- package/dist/get-fps.js +3 -0
- package/dist/get-is-hdr.js +1 -1
- package/dist/get-keyframes.js +1 -1
- package/dist/get-tracks.d.ts +1 -1
- package/dist/get-tracks.js +10 -3
- package/dist/get-video-codec.js +1 -1
- package/dist/has-all-info.js +4 -3
- package/dist/index.d.ts +20 -2
- package/dist/may-skip-video-data/need-samples-for-fields.js +1 -0
- package/dist/metadata/get-metadata.d.ts +1 -0
- package/dist/metadata/get-metadata.js +16 -1
- package/dist/options.d.ts +12 -5
- package/dist/parse-media.js +48 -43
- package/dist/parse-result.d.ts +16 -1
- package/dist/parse-video.js +9 -10
- package/dist/state/can-skip-tracks.js +1 -0
- package/dist/state/emitted-fields.js +1 -0
- package/dist/state/images.d.ts +9 -0
- package/dist/state/images.js +14 -0
- package/dist/state/mp3.d.ts +11 -0
- package/dist/state/mp3.js +13 -0
- package/dist/state/parser-state.d.ts +13 -2
- package/dist/state/parser-state.js +8 -1
- package/dist/state/sample-callbacks.js +4 -1
- package/dist/state/slow-duration-fps.d.ts +2 -1
- package/dist/state/slow-duration-fps.js +52 -18
- package/dist/throttled-progress.d.ts +14 -0
- package/dist/throttled-progress.js +44 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
package/dist/parse-video.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseVideo = void 0;
|
|
4
|
-
const
|
|
4
|
+
const parse_boxes_1 = require("./boxes/iso-base-media/parse-boxes");
|
|
5
|
+
const parse_mp3_1 = require("./boxes/mp3/parse-mp3");
|
|
5
6
|
const parse_box_1 = require("./boxes/riff/parse-box");
|
|
6
7
|
const next_pes_header_store_1 = require("./boxes/transport-stream/next-pes-header-store");
|
|
7
8
|
const parse_transport_stream_1 = require("./boxes/transport-stream/parse-transport-stream");
|
|
@@ -28,13 +29,12 @@ const parseVideo = ({ iterator, state, signal, logLevel, fields, mimeType, conte
|
|
|
28
29
|
type: 'iso-base-media',
|
|
29
30
|
boxes: initialBoxes,
|
|
30
31
|
});
|
|
31
|
-
return (0,
|
|
32
|
+
return (0, parse_boxes_1.parseIsoBaseMediaBoxes)({
|
|
32
33
|
iterator,
|
|
33
34
|
maxBytes: Infinity,
|
|
34
35
|
allowIncompleteBoxes: true,
|
|
35
36
|
initialBoxes,
|
|
36
37
|
state,
|
|
37
|
-
continueMdat: false,
|
|
38
38
|
signal,
|
|
39
39
|
logLevel,
|
|
40
40
|
fields,
|
|
@@ -63,13 +63,12 @@ const parseVideo = ({ iterator, state, signal, logLevel, fields, mimeType, conte
|
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
if (fileType.type === 'mp3') {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}));
|
|
66
|
+
const structure = {
|
|
67
|
+
boxes: [],
|
|
68
|
+
type: 'mp3',
|
|
69
|
+
};
|
|
70
|
+
state.structure.setStructure(structure);
|
|
71
|
+
return (0, parse_mp3_1.parseMp3)({ iterator, structure, state });
|
|
73
72
|
}
|
|
74
73
|
if (fileType.type === 'wav') {
|
|
75
74
|
return Promise.reject(new errors_1.IsAnUnsupportedAudioTypeError({
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type MediaParserEmbeddedImage = {
|
|
2
|
+
description: string | null;
|
|
3
|
+
mimeType: string | null;
|
|
4
|
+
data: Uint8Array;
|
|
5
|
+
};
|
|
6
|
+
export declare const imagesState: () => {
|
|
7
|
+
images: MediaParserEmbeddedImage[];
|
|
8
|
+
addImage: (image: MediaParserEmbeddedImage) => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.imagesState = void 0;
|
|
4
|
+
const imagesState = () => {
|
|
5
|
+
const images = [];
|
|
6
|
+
const addImage = (image) => {
|
|
7
|
+
images.push(image);
|
|
8
|
+
};
|
|
9
|
+
return {
|
|
10
|
+
images,
|
|
11
|
+
addImage,
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
exports.imagesState = imagesState;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type Mp3Info = {
|
|
2
|
+
sampleRate: number;
|
|
3
|
+
mpegVersion: 1 | 2;
|
|
4
|
+
layer: number;
|
|
5
|
+
bitrateKbit: number;
|
|
6
|
+
startOfMpegStream: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const makeMp3State: () => {
|
|
9
|
+
getMp3Info: () => Mp3Info | null;
|
|
10
|
+
setMp3Info: (info: Mp3Info) => void;
|
|
11
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeMp3State = void 0;
|
|
4
|
+
const makeMp3State = () => {
|
|
5
|
+
let mp3Info = null;
|
|
6
|
+
return {
|
|
7
|
+
getMp3Info: () => mp3Info,
|
|
8
|
+
setMp3Info: (info) => {
|
|
9
|
+
mp3Info = info;
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
exports.makeMp3State = makeMp3State;
|
|
@@ -10,7 +10,7 @@ export type SpsAndPps = {
|
|
|
10
10
|
sps: AvcProfileInfo;
|
|
11
11
|
pps: AvcPPs;
|
|
12
12
|
};
|
|
13
|
-
export declare const makeParserState: ({ hasAudioTrackHandlers, hasVideoTrackHandlers, signal, getIterator, fields, onAudioTrack, onVideoTrack, supportsContentRange, }: {
|
|
13
|
+
export declare const makeParserState: ({ hasAudioTrackHandlers, hasVideoTrackHandlers, signal, getIterator, fields, onAudioTrack, onVideoTrack, supportsContentRange, contentLength, }: {
|
|
14
14
|
hasAudioTrackHandlers: boolean;
|
|
15
15
|
hasVideoTrackHandlers: boolean;
|
|
16
16
|
signal: AbortSignal | undefined;
|
|
@@ -19,6 +19,7 @@ export declare const makeParserState: ({ hasAudioTrackHandlers, hasVideoTrackHan
|
|
|
19
19
|
supportsContentRange: boolean;
|
|
20
20
|
onAudioTrack: OnAudioTrack | null;
|
|
21
21
|
onVideoTrack: OnVideoTrack | null;
|
|
22
|
+
contentLength: number | null;
|
|
22
23
|
}) => {
|
|
23
24
|
riff: {
|
|
24
25
|
getAvcProfile: () => SpsAndPps | null;
|
|
@@ -73,10 +74,20 @@ export declare const makeParserState: ({ hasAudioTrackHandlers, hasVideoTrackHan
|
|
|
73
74
|
emittedFields: import("../options").AllOptions<ParseMediaFields>;
|
|
74
75
|
fields: Partial<import("../options").AllOptions<ParseMediaFields>>;
|
|
75
76
|
slowDurationAndFps: {
|
|
76
|
-
|
|
77
|
+
addVideoSample: (videoSample: import("../webcodec-sample-types").AudioOrVideoSample) => void;
|
|
78
|
+
addAudioSample: (audioSample: import("../webcodec-sample-types").AudioOrVideoSample) => void;
|
|
77
79
|
getSlowDurationInSeconds: () => number;
|
|
78
80
|
getFps: () => number;
|
|
79
81
|
getSlowNumberOfFrames: () => number;
|
|
80
82
|
};
|
|
83
|
+
mp3Info: {
|
|
84
|
+
getMp3Info: () => import("./mp3").Mp3Info | null;
|
|
85
|
+
setMp3Info: (info: import("./mp3").Mp3Info) => void;
|
|
86
|
+
};
|
|
87
|
+
contentLength: number | null;
|
|
88
|
+
images: {
|
|
89
|
+
images: import("./images").MediaParserEmbeddedImage[];
|
|
90
|
+
addImage: (image: import("./images").MediaParserEmbeddedImage) => void;
|
|
91
|
+
};
|
|
81
92
|
};
|
|
82
93
|
export type ParserState = ReturnType<typeof makeParserState>;
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeParserState = void 0;
|
|
4
4
|
const emitted_fields_1 = require("./emitted-fields");
|
|
5
|
+
const images_1 = require("./images");
|
|
5
6
|
const keyframes_1 = require("./keyframes");
|
|
7
|
+
const mp3_1 = require("./mp3");
|
|
6
8
|
const riff_1 = require("./riff");
|
|
7
9
|
const sample_callbacks_1 = require("./sample-callbacks");
|
|
8
10
|
const slow_duration_fps_1 = require("./slow-duration-fps");
|
|
9
11
|
const structure_1 = require("./structure");
|
|
10
12
|
const webm_1 = require("./webm");
|
|
11
|
-
const makeParserState = ({ hasAudioTrackHandlers, hasVideoTrackHandlers, signal, getIterator, fields, onAudioTrack, onVideoTrack, supportsContentRange, }) => {
|
|
13
|
+
const makeParserState = ({ hasAudioTrackHandlers, hasVideoTrackHandlers, signal, getIterator, fields, onAudioTrack, onVideoTrack, supportsContentRange, contentLength, }) => {
|
|
12
14
|
let skippedBytes = 0;
|
|
13
15
|
const increaseSkippedBytes = (bytes) => {
|
|
14
16
|
skippedBytes += bytes;
|
|
@@ -17,6 +19,8 @@ const makeParserState = ({ hasAudioTrackHandlers, hasVideoTrackHandlers, signal,
|
|
|
17
19
|
const keyframes = (0, keyframes_1.keyframesState)();
|
|
18
20
|
const emittedFields = (0, emitted_fields_1.emittedState)();
|
|
19
21
|
const slowDurationAndFps = (0, slow_duration_fps_1.slowDurationAndFpsState)();
|
|
22
|
+
const mp3Info = (0, mp3_1.makeMp3State)();
|
|
23
|
+
const images = (0, images_1.imagesState)();
|
|
20
24
|
return {
|
|
21
25
|
riff: (0, riff_1.riffSpecificState)(),
|
|
22
26
|
callbacks: (0, sample_callbacks_1.sampleCallback)({
|
|
@@ -46,6 +50,9 @@ const makeParserState = ({ hasAudioTrackHandlers, hasVideoTrackHandlers, signal,
|
|
|
46
50
|
emittedFields,
|
|
47
51
|
fields,
|
|
48
52
|
slowDurationAndFps,
|
|
53
|
+
mp3Info,
|
|
54
|
+
contentLength,
|
|
55
|
+
images,
|
|
49
56
|
};
|
|
50
57
|
};
|
|
51
58
|
exports.makeParserState = makeParserState;
|
|
@@ -44,6 +44,9 @@ const sampleCallback = ({ signal, hasAudioTrackHandlers, hasVideoTrackHandlers,
|
|
|
44
44
|
await callback(audioSample);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
if ((0, need_samples_for_fields_1.needsToIterateOverSamples)({ emittedFields, fields })) {
|
|
48
|
+
slowDurationAndFpsState.addAudioSample(audioSample);
|
|
49
|
+
}
|
|
47
50
|
},
|
|
48
51
|
getSamplesForTrack: (trackId) => {
|
|
49
52
|
var _a;
|
|
@@ -77,7 +80,7 @@ const sampleCallback = ({ signal, hasAudioTrackHandlers, hasVideoTrackHandlers,
|
|
|
77
80
|
sizeInBytes: videoSample.data.length,
|
|
78
81
|
});
|
|
79
82
|
}
|
|
80
|
-
slowDurationAndFpsState.
|
|
83
|
+
slowDurationAndFpsState.addVideoSample(videoSample);
|
|
81
84
|
}
|
|
82
85
|
},
|
|
83
86
|
canSkipTracksState,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AudioOrVideoSample } from '../webcodec-sample-types';
|
|
2
2
|
export declare const slowDurationAndFpsState: () => {
|
|
3
|
-
|
|
3
|
+
addVideoSample: (videoSample: AudioOrVideoSample) => void;
|
|
4
|
+
addAudioSample: (audioSample: AudioOrVideoSample) => void;
|
|
4
5
|
getSlowDurationInSeconds: () => number;
|
|
5
6
|
getFps: () => number;
|
|
6
7
|
getSlowNumberOfFrames: () => number;
|
|
@@ -2,35 +2,69 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.slowDurationAndFpsState = void 0;
|
|
4
4
|
const slowDurationAndFpsState = () => {
|
|
5
|
-
let
|
|
6
|
-
let
|
|
7
|
-
let
|
|
5
|
+
let smallestVideoSample;
|
|
6
|
+
let largestVideoSample;
|
|
7
|
+
let smallestAudioSample;
|
|
8
|
+
let largestAudioSample;
|
|
9
|
+
let videoSamples = 0;
|
|
10
|
+
let audioSamples = 0;
|
|
11
|
+
const getSlowVideoDurationInSeconds = () => {
|
|
12
|
+
let videoDuration = null;
|
|
13
|
+
if (smallestVideoSample !== undefined && largestVideoSample !== undefined) {
|
|
14
|
+
const startingTimestampDifference = largestVideoSample - smallestVideoSample;
|
|
15
|
+
const timeBetweenSamples = startingTimestampDifference / (videoSamples - 1);
|
|
16
|
+
videoDuration = timeBetweenSamples * videoSamples;
|
|
17
|
+
}
|
|
18
|
+
return videoDuration;
|
|
19
|
+
};
|
|
8
20
|
const getSlowDurationInSeconds = () => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
21
|
+
const videoDuration = getSlowVideoDurationInSeconds();
|
|
22
|
+
let audioDuration = null;
|
|
23
|
+
if (smallestAudioSample !== undefined && largestAudioSample !== undefined) {
|
|
24
|
+
const startingTimestampDifferenceAudio = largestAudioSample - smallestAudioSample;
|
|
25
|
+
const timeBetweenSamplesAudio = startingTimestampDifferenceAudio / (audioSamples - 1);
|
|
26
|
+
audioDuration = timeBetweenSamplesAudio * audioSamples;
|
|
13
27
|
}
|
|
14
|
-
|
|
28
|
+
if (videoDuration === null && audioDuration === null) {
|
|
29
|
+
throw new Error('No samples');
|
|
30
|
+
}
|
|
31
|
+
return Math.max(videoDuration !== null && videoDuration !== void 0 ? videoDuration : 0, audioDuration !== null && audioDuration !== void 0 ? audioDuration : 0);
|
|
15
32
|
};
|
|
16
33
|
return {
|
|
17
|
-
|
|
18
|
-
|
|
34
|
+
addVideoSample: (videoSample) => {
|
|
35
|
+
videoSamples++;
|
|
19
36
|
const presentationTimeInSeconds = videoSample.cts / videoSample.timescale;
|
|
20
|
-
if (
|
|
21
|
-
presentationTimeInSeconds >
|
|
22
|
-
|
|
37
|
+
if (largestVideoSample === undefined ||
|
|
38
|
+
presentationTimeInSeconds > largestVideoSample) {
|
|
39
|
+
largestVideoSample = presentationTimeInSeconds;
|
|
23
40
|
}
|
|
24
|
-
if (
|
|
25
|
-
presentationTimeInSeconds <
|
|
26
|
-
|
|
41
|
+
if (smallestVideoSample === undefined ||
|
|
42
|
+
presentationTimeInSeconds < smallestVideoSample) {
|
|
43
|
+
smallestVideoSample = presentationTimeInSeconds;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
addAudioSample: (audioSample) => {
|
|
47
|
+
audioSamples++;
|
|
48
|
+
const presentationTimeInSeconds = audioSample.cts / audioSample.timescale;
|
|
49
|
+
if (largestAudioSample === undefined ||
|
|
50
|
+
presentationTimeInSeconds > largestAudioSample) {
|
|
51
|
+
largestAudioSample = presentationTimeInSeconds;
|
|
52
|
+
}
|
|
53
|
+
if (smallestAudioSample === undefined ||
|
|
54
|
+
presentationTimeInSeconds < smallestAudioSample) {
|
|
55
|
+
smallestAudioSample = presentationTimeInSeconds;
|
|
27
56
|
}
|
|
28
57
|
},
|
|
29
58
|
getSlowDurationInSeconds,
|
|
30
59
|
getFps: () => {
|
|
31
|
-
|
|
60
|
+
var _a;
|
|
61
|
+
const videoDuration = (_a = getSlowVideoDurationInSeconds()) !== null && _a !== void 0 ? _a : 0;
|
|
62
|
+
if (videoDuration === 0) {
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
return videoSamples / videoDuration;
|
|
32
66
|
},
|
|
33
|
-
getSlowNumberOfFrames: () =>
|
|
67
|
+
getSlowNumberOfFrames: () => videoSamples,
|
|
34
68
|
};
|
|
35
69
|
};
|
|
36
70
|
exports.slowDurationAndFpsState = slowDurationAndFpsState;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ParseMediaOnProgress, ParseMediaProgress } from './options';
|
|
2
|
+
type ReturnType = {
|
|
3
|
+
get: () => ParseMediaProgress;
|
|
4
|
+
update: ParseMediaProgressFn | null;
|
|
5
|
+
stopAndGetLastProgress: () => void;
|
|
6
|
+
};
|
|
7
|
+
export type ParseMediaProgressFn = (state: (prevState: ParseMediaProgress) => ParseMediaProgress) => void;
|
|
8
|
+
export declare const throttledStateUpdate: ({ updateFn, everyMilliseconds, signal, }: {
|
|
9
|
+
updateFn: ParseMediaOnProgress | null;
|
|
10
|
+
everyMilliseconds: number;
|
|
11
|
+
signal: AbortSignal | undefined;
|
|
12
|
+
totalBytes: number | null;
|
|
13
|
+
}) => ReturnType;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.throttledStateUpdate = void 0;
|
|
4
|
+
const throttledStateUpdate = ({ updateFn, everyMilliseconds, signal, }) => {
|
|
5
|
+
let currentState = {
|
|
6
|
+
bytes: 0,
|
|
7
|
+
percentage: null,
|
|
8
|
+
totalBytes: null,
|
|
9
|
+
};
|
|
10
|
+
if (!updateFn) {
|
|
11
|
+
return {
|
|
12
|
+
get: () => currentState,
|
|
13
|
+
update: null,
|
|
14
|
+
stopAndGetLastProgress: () => { },
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
let lastUpdated = null;
|
|
18
|
+
const callUpdateIfChanged = () => {
|
|
19
|
+
if (currentState === lastUpdated) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
updateFn(currentState);
|
|
23
|
+
lastUpdated = currentState;
|
|
24
|
+
};
|
|
25
|
+
const interval = setInterval(() => {
|
|
26
|
+
callUpdateIfChanged();
|
|
27
|
+
}, everyMilliseconds);
|
|
28
|
+
const onAbort = () => {
|
|
29
|
+
clearInterval(interval);
|
|
30
|
+
};
|
|
31
|
+
signal === null || signal === void 0 ? void 0 : signal.addEventListener('abort', onAbort, { once: true });
|
|
32
|
+
return {
|
|
33
|
+
get: () => currentState,
|
|
34
|
+
update: (fn) => {
|
|
35
|
+
currentState = fn(currentState);
|
|
36
|
+
},
|
|
37
|
+
stopAndGetLastProgress: () => {
|
|
38
|
+
clearInterval(interval);
|
|
39
|
+
signal === null || signal === void 0 ? void 0 : signal.removeEventListener('abort', onAbort);
|
|
40
|
+
return currentState;
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
exports.throttledStateUpdate = throttledStateUpdate;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.
|
|
1
|
+
export declare const VERSION = "4.0.249";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/media-parser"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/media-parser",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.249",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"devDependencies": {
|
|
10
10
|
"@types/wicg-file-system-access": "2023.10.5",
|
|
11
11
|
"eslint": "9.14.0",
|
|
12
|
-
"@remotion/example-videos": "4.0.
|
|
13
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
12
|
+
"@remotion/example-videos": "4.0.249",
|
|
13
|
+
"@remotion/eslint-config-internal": "4.0.249"
|
|
14
14
|
},
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|