NorskInput.fileMp4() method

Read a MP4 (fragmented or not) from a file with realtime playback. This will not play frames that are written to the file after the node starts.

Signature:

fileMp4(settings: FileMp4InputSettings): Promise<FileMp4InputNode>;

Parameters

Parameter Type Description

settings

FileMp4InputSettings

Configuration for the file input

Returns:

Promise<FileMp4InputNode>

Example [06_mp4file_to_webrtc.ts]

Publish a local MP4 files as a WebRTC stream

// Note how, other than the input line, this example and the other xxx_to_webrtc
// examples are identical.
const fileName = "/mnt/data/TraditionalMusic.mp4";

const norsk = await Norsk.connect();

const input = await norsk.input.fileMp4({ id: "fileMp4", sourceName: "example.mp4", fileName, loop: true });
const output = await norsk.output.whep({ id: "webrtc", ...webRtcServerConfig });

output.subscribe([{ source: input, sourceSelector: selectAV }]);

console.log(`WebRTC Player URL: ${output.playerUrl}`);

Find Examples