JSFiddle - React, Tailwind, and code Playground
JavaScript
var pc = new webkitRTCPeerConnection(null, null);
/* global webkitAudioContext */
var wacx = new webkitAudioContext();
function createOffer() {
var numRequestedAudioTracks = 1;
while (numRequestedAudioTracks < pc.getLocalStreams().length) {
pc.removeStream(pc.getLocalStreams()[pc.getLocalStreams().length - 1]);
}
pc.createOffer(gotDescription, null, null);
while (numRequestedAudioTracks > pc.getLocalStreams().length) {
// Create some dummy audio streams using Web Audio.
// Note that this fails if you try to do more than one track in Chrome
// right now.
var dst = wacx.createMediaStreamDestination();
pc.addStream(dst.stream);
}
//pc.createOffer(gotDescription, null, null);
}
function gotDescription(desc) {
console.log(desc.sdp);
if (desc.sdp.indexOf("a=msid:") === -1) {
alert("pass");
} else {
alert("fail");
}
}
createOffer();