Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ts-sdk] Fix standalone Mp4 component shorter than video #975

Merged
Merged
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
18 changes: 15 additions & 3 deletions ts/smelter-core/src/offline/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,14 @@ class OfflineOutput {
? intoAudioInputsConfiguration(this.audioContext.getAudioConfig())
: undefined;
const video = this.supportsVideo ? { root: this.renderer.scene() } : undefined;
const schedule_time_ms = this.timeContext.timestampMs();
if (schedule_time_ms === Infinity) {
throw new Error('Generating a scene without timestamp.');
}
return {
video,
audio,
schedule_time_ms: this.timeContext.timestampMs(),
schedule_time_ms,
};
}

Expand Down Expand Up @@ -186,13 +190,17 @@ class OutputContext implements SmelterOutputContext {
};
}
public async unregisterMp4Input(inputId: number): Promise<void> {
const schedule_time_ms = this.timeContext.timestampMs();
if (schedule_time_ms === Infinity) {
return;
}
await this.output.api.unregisterInput(
{
type: 'output-specific-input',
outputId: this.outputId,
id: inputId,
},
{ schedule_time_ms: this.timeContext.timestampMs() }
{ schedule_time_ms }
);
}
public async registerImage(imageId: number, imageSpec: Renderers.RegisterImage) {
Expand All @@ -209,13 +217,17 @@ class OutputContext implements SmelterOutputContext {
});
}
public async unregisterImage(imageId: number) {
const schedule_time_ms = this.timeContext.timestampMs();
if (schedule_time_ms === Infinity) {
return;
}
await this.output.api.unregisterImage(
{
type: 'output-specific-image',
outputId: this.outputId,
id: imageId,
},
{ schedule_time_ms: this.timeContext.timestampMs() }
{ schedule_time_ms }
);
}
}
Expand Down