JSFiddle - React, Tailwind, and code Playground

by fippo

HTML

<script src="https://wpt.live/webrtc/third_party/sdp/sdp.js"></script>

JavaScript

const pc = new RTCPeerConnection();
const t1 = pc.addTransceiver('video');
const t2 = pc.addTransceiver('video');
console.log(t1.headerExtensionsToOffer);
t1.setOfferedRtpHeaderExtensions([{direction: 'stopped', uri: 'http://www.webrtc.org/experiments/rtp-hdrext/video-timing'}]);
//t2.setOfferedRtpHeaderExtensions([{direction: 'stopped', uri: 'http://www.webrtc.org/experiments/rtp-hdrext/video-timing'}]);
pc.createOffer()
.then(offer => {
  const sections = SDPUtils.splitSections(offer.sdp);
  sections.shift();
  sections.forEach(section => {
    const extensions = SDPUtils.matchPrefix(section, 'a=extmap:')
      .map(SDPUtils.parseExtmap);
    console.log(SDPUtils.getMid(section), extensions);
  })
})