useAudioInput
useAudioInput
can be used to control audio configuration. If you’re using the InputStream
component, you can use the mute
and volume
properties to control the audio instead.
Reference
import { View, useAudioInput } from "@swmansion/smelter";import Smelter from "@swmansion/smelter-node";
function ExampleApp() { useAudioInput("input_1", { volume: 0.5 });
return <View />;}
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("input_1", { type: "mp4", serverPath: "./inputExample.mp4", });
await smelter.start();}void run();
function useAudioInput(inputId: string, audioOptions: AudioOptions);
Type definitions
type AudioOptions = { volume: number}
function useAudioInput(inputId: string, audioOptions: AudioOptions);
Arguments
inputId
ID of an input. It identifies a stream registered using a Smelter.registerInput method.
- Type:
string
audioOptions
volume
- Number between 0 and 1 representing the audio volume.
- Type:
{ volume: number }