Skip to content

Commit aedb2ce

Browse files
authored
Add note that SDP munging is a deprecated unsupported feature (#1710)
and show the error.
1 parent 28f2822 commit aedb2ce

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/content/peerconnection/munge-sdp/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ <h1><a href="//webrtc.github.io/samples/" title="WebRTC samples homepage">WebRTC
5757
<button id="setAnswer" disabled>Set answer</button>
5858
<button id="hangup" disabled>Hang up</button>
5959
</div>
60+
<p><b>Note:</b> SDP "munging", i.e. modifying the SDP between <i>createOffer</i>/<i>createAnswer</i> and <i>setLocalDescription</i>
61+
is a nonstandard feature which may not work as expected. While some browsers support some modifications,
62+
<a href="https://w3c.github.io/webrtc-pc/#dom-peerconnection-setlocaldescription">the W3C standard</a> forbids it.</p>
63+
<p id="munge-error"></p>
6064

6165
<div id="preview">
6266
<div id="local">

src/content/peerconnection/munge-sdp/js/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,16 @@ function createPeerConnection() {
138138
if (audioTracks.length > 0) {
139139
console.log(`Using audio device: ${audioTracks[0].label}`);
140140
}
141-
const servers = null;
142141

143-
localPeerConnection = new RTCPeerConnection(servers);
142+
localPeerConnection = new RTCPeerConnection();
144143
console.log('Created local peer connection object localPeerConnection');
145144
localPeerConnection.onicecandidate = e => onIceCandidate(localPeerConnection, e);
146145
sendChannel = localPeerConnection.createDataChannel('sendDataChannel', dataChannelOptions);
147146
sendChannel.onopen = onSendChannelStateChange;
148147
sendChannel.onclose = onSendChannelStateChange;
149148
sendChannel.onerror = onSendChannelStateChange;
150149

151-
remotePeerConnection = new RTCPeerConnection(servers);
150+
remotePeerConnection = new RTCPeerConnection();
152151
console.log('Created remote peer connection object remotePeerConnection');
153152
remotePeerConnection.onicecandidate = e => onIceCandidate(remotePeerConnection, e);
154153
remotePeerConnection.ontrack = gotRemoteStream;
@@ -165,6 +164,7 @@ function onSetSessionDescriptionSuccess() {
165164

166165
function onSetSessionDescriptionError(error) {
167166
console.log(`Failed to set session description: ${error.toString()}`);
167+
document.getElementById('munge-error').innerText = error.toString();
168168
}
169169

170170
async function createOffer() {

0 commit comments

Comments
 (0)