channelCount
HTML
<video id="video1" height="120" width="160" autoplay muted></video>
<video id="video2" height="120" width="160" autoplay></video><br>
<div id="div"></div>
JavaScript
let log = msg => div.innerHTML += msg + "<br>";
let gUM = c => navigator.mediaDevices.getUserMedia(c);
let pc1 = new RTCPeerConnection(), pc2 = new RTCPeerConnection();
(async () => {
pc1.addStream(video1.srcObject = await gUM({video: true, audio: true}));
const [audioTrack] = video1.srcObject.getAudioTracks();
log("channelCount: " + audioTrack.getSettings().channelCount + "<br>");
})().catch(e => log(e));
let iceDone = new Promise(resolve => {
pc1.onicecandidate = e => {
if (!e.candidate) resolve();
log("ICE: " + e.candidate.candidate);
pc2.addIceCandidate(e.candidate);
};
});
pc2.onicecandidate = e => pc1.addIceCandidate(e.candidate);
pc1.oniceconnectionstatechange = e => log(pc1.iceConnectionState);
pc1.onnegotiationneeded = async e => {
await pc1.setLocalDescription(await pc1.createOffer());
await iceDone;
pc1.localDescription.sdp.split('\r\n').slice(1).forEach(mline =>
log(mline));
await pc2.setRemoteDescription(pc1.localDescription);
await pc2.setLocalDescription(await pc2.createAnswer());
await pc1.setRemoteDescription(pc2.localDescription);
}
pc2.ontrack = e => video2.srcObject = e.streams[0];