How to use the mediasoup-client/lib/handlers/sdp/commonUtils.extractRtpCapabilities function in mediasoup-client

To help you get started, we’ve selected a few mediasoup-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kurento / mediasoup-demos / mediasoup-kurento-filter / server.js View on Github external
global.kurento.rtp.sendEndpoint = kmsEndpoint;

  console.log("SDP Offer from App to Kurento RTP SEND: %s\n", kmsSdpOffer);
  const kmsSdpAnswer = await kmsEndpoint.processOffer(kmsSdpOffer);
  console.log("SDP Answer from Kurento RTP SEND to App:\n%s", kmsSdpAnswer);

  // WARNING: A real application would need to parse this SDP Answer and adapt
  // to the parameters given in it, following the SDP Offer/Answer Model.

  const kmsSdpAnswerObj = SdpTransform.parse(kmsSdpAnswer);
  console.log("kmsSdpAnswerObj: %s", JSON.stringify(kmsSdpAnswerObj, null, 2));

  // Build an RtpSendParameters from the Kurento SDP Answer,
  // this gives us the Kurento RTP stream's SSRC, payload type, etc.

  const kmsRtpCapabilities = MediasoupSdpUtils.extractRtpCapabilities({
    sdpObject: kmsSdpAnswerObj
  });
  console.log(
    "kmsRtpCapabilities: %s",
    JSON.stringify(kmsRtpCapabilities, null, 2)
  );

  const msExtendedRtpCapabilities = MediasoupOrtc.getExtendedRtpCapabilities(
    kmsRtpCapabilities,
    global.mediasoup.router.rtpCapabilities
  );
  console.log(
    "msExtendedRtpCapabilities: %s",
    JSON.stringify(msExtendedRtpCapabilities, null, 2)
  );