Skip to content

InputStream

A component for displaying registered media inputs.

Reference

InputStreamExample.tsx
import { InputStream, Rescaler } from "@swmansion/smelter";
import Smelter from "@swmansion/smelter-node";
function ExampleApp() {
return (
<Rescaler>
<InputStream inputId="example_input" volume={0.5} />
</Rescaler>
);
}
async function run() {
const smelter = new Smelter();
await smelter.init();
await smelter.registerOutput("output", <ExampleApp />, {
18 collapsed lines
type: "mp4",
serverPath: "./output.mp4",
video: {
encoder: {
type: "ffmpeg_h264",
preset: "ultrafast",
},
resolution: {
width: 1920,
height: 1080,
},
},
audio: {
encoder: {
type: "aac",
channels: "stereo",
},
},
});
await smelter.registerInput("example_input", {
type: "mp4",
serverPath: "./inputExample.mp4",
});
await smelter.start();
}
void run();
Type definitions

type InputStreamProps = {
id?: string;
inputId: string;
volume?: number;
mute?: boolean;
}

Props

inputId

ID of an input. It identifies a stream registered using a Smelter.registerInput method.

  • Type: string

id

ID of a component.

  • Type: string
  • Default value: Value produced by useId hook

volume

Audio volume of the input stream. Accepts values between 0 and 1.

  • Type: number
  • Default value: 1

mute

Determines whether to mute audio of the input stream.

  • Type: boolean
  • Default value: false