Here is my code
function createPeer(userID) { const peer = new RTCPeerConnection({ iceServers: [ { urls: "stun:stun.stunprotocol.org" }, { urls: 'turn:numb.viagenie.ca', credential: 'redacted', username: 'webrtc@live.com' }, ] }); peer.onicecandidate = () => { }; peer.ontrack = () => { }; peer.onnegotiationneeded = () => { }; return peer; } navigator.mediaDevices.getUserMedia({ video: true, audio: true }).then(stream => { const peer = createPeer(); peer.getSenders(); stream.getTracks().forEach(track => peer.addTrack(track, stream)); peer.getSenders().forEach(sender => { if (sender.track.kind === "video") { const params = sender.getParameters(); params.encodings.push({ maxBitrate: 100 }); sender.setParameters(params); } }) });
I dont understand why I get the error
Uncaught (in promise) DOMException: Read-only field modified in setParameters().
I thought bitrate was something I can change. Furthermore, I am changing the parameters I am getting by calling the sender.getParameters();
which is what the mdn docs say to do.
Where am I going wrong?
https://stackoverflow.com/questions/65433292/uncaught-in-promise-domexception-read-only-field-modified-in-setparameters December 24, 2020 at 10:33AM
没有评论:
发表评论