Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/docs/docs/renderer/render-media.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ The return value is an object with the following properties:

- `buffer`: If `outputLocation` is not specified or `null`, contains a buffer, otherwise `null`.
- `slowestFrames`: An array of the 10 slowest frames in the shape of `{frame:<Frame number>, time:<Time to render frame ms>}`. You can use this information to optimise your render times.
- `mimeType`: <AvailableFrom v="4.0.426" inline /> The MIME type of the rendered output, e.g. `"video/mp4"`, `"video/webm"`, `"image/gif"`.
- `contentType`: <AvailableFrom v="4.0.426" inline /> The content type of the rendered output, e.g. `"video/mp4"`, `"video/webm"`, `"image/gif"`.

_**from v3.0.26**:_

Expand Down
2 changes: 1 addition & 1 deletion packages/docs/docs/renderer/render-still.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ Renamed to `jpegQuality` in `v4.0.0`.
The return value is a promise that resolves to an object with the following keys:

- `buffer`: <AvailableFrom v="3.3.9" inline /> A `Buffer` that only exists if no `output` option was provided. Otherwise null.
- `mimeType`: <AvailableFrom v="4.0.426" inline /> The MIME type of the rendered output, e.g. `"image/png"`, `"image/jpeg"`.
- `contentType`: <AvailableFrom v="4.0.426" inline /> The content type of the rendered output, e.g. `"image/png"`, `"image/jpeg"`.

## Compatibility

Expand Down
4 changes: 2 additions & 2 deletions packages/it-tests/src/ssr/render-media.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ test('Render video to a buffer', async () => {
throw new Error('not found');
}

const {buffer, mimeType} = await renderMedia({
const {buffer, contentType} = await renderMedia({
codec: 'h264',
serveUrl:
'https://661808694cad562ef2f35be7--incomparable-dasik-a4482b.netlify.app/',
Expand All @@ -134,7 +134,7 @@ test('Render video to a buffer', async () => {
});

expect(buffer?.length).toBeGreaterThan(2000);
expect(mimeType).toBe('video/mp4');
expect(contentType).toBe('video/mp4');
});

test('Should fail invalid serve URL', async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/renderer/src/render-media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ type Await<T> = T extends PromiseLike<infer U> ? U : T;
type RenderMediaResult = {
buffer: Buffer | null;
slowestFrames: SlowFrame[];
mimeType: string;
contentType: string;
};

const internalRenderMediaRaw = ({
Expand Down Expand Up @@ -828,7 +828,7 @@ const internalRenderMediaRaw = ({
const result: RenderMediaResult = {
buffer,
slowestFrames,
mimeType:
contentType:
mimeLookup(
'file.' + getFileExtensionFromCodec(codec, audioCodec),
) || 'application/octet-stream',
Expand Down
5 changes: 3 additions & 2 deletions packages/renderer/src/render-still.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export type RenderStillOptions = {
};

type CleanupFn = () => Promise<unknown>;
type RenderStillReturnValue = {buffer: Buffer | null; mimeType: string};
type RenderStillReturnValue = {buffer: Buffer | null; contentType: string};

const innerRenderStill = async ({
composition,
Expand Down Expand Up @@ -387,7 +387,8 @@ const innerRenderStill = async ({

return {
buffer: output ? null : buffer,
mimeType: mimeLookup('file.' + imageFormat) || 'application/octet-stream',
contentType:
mimeLookup('file.' + imageFormat) || 'application/octet-stream',
};
};

Expand Down
4 changes: 2 additions & 2 deletions packages/renderer/src/test/render-still.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test(
async () => {
await ensureBrowser();

const {buffer, mimeType} = await renderStill({
const {buffer, contentType} = await renderStill({
composition: {
width: 1000,
height: 1000,
Expand All @@ -62,7 +62,7 @@ test(
verbose: false,
});
expect(buffer?.length).toBeGreaterThan(1000);
expect(mimeType).toBe('image/png');
expect(contentType).toBe('image/png');
},
{
timeout: 30000,
Expand Down
Loading