createFrameWriter
function createFrameWriter<F>(track, options?): FrameWriter<F>;Defined in: relay-sdks/ts/src/frame-writer.ts:127
Map encoded frames onto a registered track’s groups (spec/behavior.md, “Media publishing”).
A frame the relay has no subscription for is 'skipped' at once, because an encoder loop cannot block on the write
deadline; publishing resumes at the next keyframe. When the backlog is full the transport has fallen behind:
keyframe grouping drops the backlog and the open group, frame grouping drops the oldest frame. Under keyframe grouping
the writer watches the track’s demand from now until it closes, and says when it needs a keyframe.
const writer = createFrameWriter(track, { onKeyframeNeeded: () => (forceKeyframe = true) });// in the VideoEncoder output callback, without awaiting:void writer.write(chunkToLocFrame(chunk, { videoConfig })).then(count);Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
F extends Frame |
Frame |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
track |
RelayTrackWriter |
options? |
FrameWriterOptions<F> |
Returns
Section titled “Returns”FrameWriter<F>