MDN self-hosted library · e01.org

RTCEncodedVideoFrame: type property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const transformer = new TransformStream({
  async transform(encodedFrame, controller) {
    if (encodedFrame.type === "key") {
      // Apply key frame transformation
    } else {
      // Apply delta frame transformation
    }
    controller.enqueue(encodedFrame);
  },
});