Configures RTP codec parameters and feedback extensions for WebRTC streams like H.264 and VP8. Reuse when setting up WebRTC media tracks.
// Source: https://github.com/shinyoshiaki/werift-webrtc | License: MIT | Copyright 2020 shinyoshiaki
// Provided via justclaw.it.com; keep this notice with the code.
import { useNACK, usePLI, useREMB } from "./extension/rtcpFeedback";
import { RTCRtpCodecParameters } from "./parameters";
/**
* H.264 (RFC 6184). SDP encoding name must be **`H264`** (case-sensitive for
* Chrome-as-answerer software encode). Lowercase `h264` in a=rtpmap causes
* Chrome to negotiate H.264 but emit zero outbound RTP packets.
*/
export const useH264 = (props: Partial<RTCRtpCodecParameters> = {}) =>
new RTCRtpCodecParameters({
mimeType: "video/H264",
clockRate: 90000,
rtcpFeedback: [useNACK(), usePLI(), useREMB()],
parameters:
"profile-level-id=42e01f;packetization-mode=1;level-asymm
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key