@remotion/media-parser 4.0.230 → 4.0.231

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.
Files changed (41) hide show
  1. package/dist/boxes/webm/parse-webm-header.js +23 -4
  2. package/dist/boxes/webm/segments/parse-children.d.ts +12 -7
  3. package/dist/boxes/webm/segments/parse-children.js +67 -57
  4. package/dist/boxes/webm/segments.d.ts +8 -3
  5. package/dist/boxes/webm/segments.js +70 -39
  6. package/dist/create/iso-base-media/create-iso-base-media.d.ts +1 -1
  7. package/dist/create/iso-base-media/create-iso-base-media.js +4 -5
  8. package/dist/create/matroska/cluster.d.ts +7 -1
  9. package/dist/create/matroska/cluster.js +8 -5
  10. package/dist/create/matroska/create-matroska-media.d.ts +1 -1
  11. package/dist/create/matroska/create-matroska-media.js +27 -10
  12. package/dist/create/media-fn.d.ts +1 -0
  13. package/dist/emit-available-info.d.ts +1 -1
  14. package/dist/emit-available-info.js +23 -10
  15. package/dist/esm/buffer.mjs +2 -2
  16. package/dist/esm/index.mjs +591 -465
  17. package/dist/esm/web-fs.mjs +2 -2
  18. package/dist/get-audio-codec.d.ts +1 -1
  19. package/dist/get-audio-codec.js +2 -7
  20. package/dist/get-duration.d.ts +5 -0
  21. package/dist/get-duration.js +7 -3
  22. package/dist/get-fps.js +7 -0
  23. package/dist/get-video-codec.d.ts +2 -2
  24. package/dist/get-video-codec.js +2 -6
  25. package/dist/has-all-info.d.ts +1 -1
  26. package/dist/has-all-info.js +8 -8
  27. package/dist/index.d.ts +4 -3
  28. package/dist/index.js +3 -1
  29. package/dist/options.d.ts +8 -1
  30. package/dist/parse-media.js +41 -14
  31. package/dist/parse-result.d.ts +15 -0
  32. package/dist/parse-video.d.ts +1 -1
  33. package/dist/parse-video.js +3 -0
  34. package/dist/readers/reader.d.ts +2 -2
  35. package/dist/version.d.ts +1 -0
  36. package/dist/version.js +5 -0
  37. package/dist/writers/buffer-implementation/writer.d.ts +2 -2
  38. package/dist/writers/buffer-implementation/writer.js +2 -2
  39. package/dist/writers/web-fs.js +2 -3
  40. package/dist/writers/writer.d.ts +5 -3
  41. package/package.json +3 -3
@@ -13,7 +13,7 @@ const emitAvailableInfo = ({ hasInfo, parseResult, moreFields, state, returnValu
13
13
  const keys = Object.keys(hasInfo);
14
14
  for (const key of keys) {
15
15
  if (key === 'boxes') {
16
- if (hasInfo.boxes && returnValue.boxes === undefined) {
16
+ if (parseResult && hasInfo.boxes && returnValue.boxes === undefined) {
17
17
  (_a = moreFields.onBoxes) === null || _a === void 0 ? void 0 : _a.call(moreFields, parseResult.segments);
18
18
  returnValue.boxes = parseResult.segments;
19
19
  }
@@ -21,7 +21,8 @@ const emitAvailableInfo = ({ hasInfo, parseResult, moreFields, state, returnValu
21
21
  }
22
22
  if (key === 'durationInSeconds') {
23
23
  if (hasInfo.durationInSeconds &&
24
- returnValue.durationInSeconds === undefined) {
24
+ returnValue.durationInSeconds === undefined &&
25
+ parseResult) {
25
26
  const durationInSeconds = (0, get_duration_1.getDuration)(parseResult.segments, state);
26
27
  (_b = moreFields.onDurationInSeconds) === null || _b === void 0 ? void 0 : _b.call(moreFields, durationInSeconds);
27
28
  returnValue.durationInSeconds = durationInSeconds;
@@ -29,7 +30,9 @@ const emitAvailableInfo = ({ hasInfo, parseResult, moreFields, state, returnValu
29
30
  continue;
30
31
  }
31
32
  if (key === 'dimensions') {
32
- if (hasInfo.dimensions && returnValue.dimensions === undefined) {
33
+ if (hasInfo.dimensions &&
34
+ returnValue.dimensions === undefined &&
35
+ parseResult) {
33
36
  const dimensionsQueried = (0, get_dimensions_1.getDimensions)(parseResult.segments, state);
34
37
  const dimensions = {
35
38
  height: dimensionsQueried.height,
@@ -42,7 +45,8 @@ const emitAvailableInfo = ({ hasInfo, parseResult, moreFields, state, returnValu
42
45
  }
43
46
  if (key === 'unrotatedDimensions') {
44
47
  if (returnValue.unrotatedDimensions === undefined &&
45
- hasInfo.unrotatedDimensions) {
48
+ hasInfo.unrotatedDimensions &&
49
+ parseResult) {
46
50
  const dimensionsQueried = (0, get_dimensions_1.getDimensions)(parseResult.segments, state);
47
51
  const unrotatedDimensions = {
48
52
  height: dimensionsQueried.unrotatedHeight,
@@ -54,7 +58,9 @@ const emitAvailableInfo = ({ hasInfo, parseResult, moreFields, state, returnValu
54
58
  continue;
55
59
  }
56
60
  if (key === 'rotation') {
57
- if (returnValue.rotation === undefined && hasInfo.rotation) {
61
+ if (returnValue.rotation === undefined &&
62
+ hasInfo.rotation &&
63
+ parseResult) {
58
64
  const dimensionsQueried = (0, get_dimensions_1.getDimensions)(parseResult.segments, state);
59
65
  const { rotation } = dimensionsQueried;
60
66
  (_e = moreFields.onRotation) === null || _e === void 0 ? void 0 : _e.call(moreFields, rotation);
@@ -63,7 +69,7 @@ const emitAvailableInfo = ({ hasInfo, parseResult, moreFields, state, returnValu
63
69
  continue;
64
70
  }
65
71
  if (key === 'fps') {
66
- if (returnValue.fps === undefined && hasInfo.fps) {
72
+ if (returnValue.fps === undefined && hasInfo.fps && parseResult) {
67
73
  const fps = (0, get_fps_1.getFps)(parseResult.segments);
68
74
  (_f = moreFields.onFps) === null || _f === void 0 ? void 0 : _f.call(moreFields, fps);
69
75
  returnValue.fps = fps;
@@ -71,7 +77,9 @@ const emitAvailableInfo = ({ hasInfo, parseResult, moreFields, state, returnValu
71
77
  continue;
72
78
  }
73
79
  if (key === 'videoCodec') {
74
- if (returnValue.videoCodec === undefined && hasInfo.videoCodec) {
80
+ if (returnValue.videoCodec === undefined &&
81
+ hasInfo.videoCodec &&
82
+ parseResult) {
75
83
  const videoCodec = (0, get_video_codec_1.getVideoCodec)(parseResult.segments);
76
84
  (_g = moreFields.onVideoCodec) === null || _g === void 0 ? void 0 : _g.call(moreFields, videoCodec);
77
85
  returnValue.videoCodec = videoCodec;
@@ -79,7 +87,9 @@ const emitAvailableInfo = ({ hasInfo, parseResult, moreFields, state, returnValu
79
87
  continue;
80
88
  }
81
89
  if (key === 'audioCodec') {
82
- if (returnValue.audioCodec === undefined && hasInfo.audioCodec) {
90
+ if (returnValue.audioCodec === undefined &&
91
+ hasInfo.audioCodec &&
92
+ parseResult) {
83
93
  const audioCodec = (0, get_audio_codec_1.getAudioCodec)(parseResult.segments, state);
84
94
  (_h = moreFields.onAudioCodec) === null || _h === void 0 ? void 0 : _h.call(moreFields, audioCodec);
85
95
  returnValue.audioCodec = audioCodec;
@@ -89,7 +99,8 @@ const emitAvailableInfo = ({ hasInfo, parseResult, moreFields, state, returnValu
89
99
  if (key === 'tracks') {
90
100
  if (hasInfo.tracks &&
91
101
  returnValue.videoTracks === undefined &&
92
- returnValue.audioTracks === undefined) {
102
+ returnValue.audioTracks === undefined &&
103
+ parseResult) {
93
104
  const { videoTracks, audioTracks } = (0, get_tracks_1.getTracks)(parseResult.segments, state);
94
105
  (_j = moreFields.onTracks) === null || _j === void 0 ? void 0 : _j.call(moreFields, { videoTracks, audioTracks });
95
106
  returnValue.videoTracks = videoTracks;
@@ -120,7 +131,9 @@ const emitAvailableInfo = ({ hasInfo, parseResult, moreFields, state, returnValu
120
131
  continue;
121
132
  }
122
133
  if (key === 'container') {
123
- if (returnValue.container === undefined && hasInfo.container) {
134
+ if (returnValue.container === undefined &&
135
+ hasInfo.container &&
136
+ parseResult) {
124
137
  const container = (0, get_container_1.getContainer)(parseResult.segments);
125
138
  (_o = moreFields.onContainer) === null || _o === void 0 ? void 0 : _o.call(moreFields, container);
126
139
  returnValue.container = container;
@@ -1,5 +1,5 @@
1
1
  // src/writers/buffer-implementation/writer.ts
2
- var createContent = () => {
2
+ var createContent = ({ filename, mimeType }) => {
3
3
  const buf = new ArrayBuffer(0, {
4
4
  maxByteLength: 2000000000
5
5
  });
@@ -29,7 +29,7 @@ var createContent = () => {
29
29
  return Promise.reject(new Error("Already called .remove() on the result"));
30
30
  }
31
31
  const arr = new Uint8Array(buf);
32
- return Promise.resolve(new File([arr.slice()], "hi", { type: "video/webm" }));
32
+ return Promise.resolve(new File([arr.slice()], filename, { type: mimeType }));
33
33
  },
34
34
  remove() {
35
35
  removed = true;