diff --git a/webrtc/RTCDtlsTransport-state.html b/webrtc/RTCDtlsTransport-state.html
index ca49fcc95f297e..33d49677c496dd 100644
--- a/webrtc/RTCDtlsTransport-state.html
+++ b/webrtc/RTCDtlsTransport-state.html
@@ -93,8 +93,22 @@
t.add_cleanup(() => pc1.close());
t.add_cleanup(() => pc2.close());
- pc1.onicecandidate = e => pc2.addIceCandidate(e.candidate);
- pc2.onicecandidate = e => pc1.addIceCandidate(e.candidate);
+ pc1.onicecandidate = e => {
+ if (e.candidate) {
+ pc2.addIceCandidate({
+ candidate: e.candidate.candidate,
+ sdpMid: e.candidate.sdpMid
+ });
+ }
+ }
+ pc2.onicecandidate = e => {
+ if (e.candidate) {
+ pc1.addIceCandidate({
+ candidate: e.candidate.candidate,
+ sdpMid: e.candidate.sdpMid
+ });
+ }
+ }
pc1.addTransceiver("video");
pc1.addTransceiver("audio");