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

const fileName = await fs.realpath("./data/mp4_h264_fragmented.mp4");

const norsk = await Norsk.connect();

let input = await norsk.input.fileMp4({ id: "fileMp4", sourceName: "example.mp4", fileName: fileName });
let output = await norsk.duplex.webRtcBrowser({ id: "webrtc" });

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

console.log(`Local player: ${output.playerUrl}`);

Find Examples