Skip to content

Commit

Permalink
webrtc: show error when setLocalDescription or createOffer fail (#3417)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 authored Jun 2, 2024
1 parent ca6e125 commit c37e895
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
14 changes: 11 additions & 3 deletions internal/servers/webrtc/publish_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,16 @@
pc.createOffer()
.then((offer) => {
offerData = parseOffer(offer.sdp);
pc.setLocalDescription(offer);
sendOffer(offer.sdp);
pc.setLocalDescription(offer)
.then(() => {
sendOffer(offer.sdp);
})
.catch((err) => {
onError(err.toString());
});
})
.catch((err) => {
onError(err.toString());
});
};

Expand All @@ -491,7 +499,7 @@
}

if (pc.iceConnectionState === 'disconnected') {
onError('peer connection disconnected', true);
onError('peer connection closed', true);
} else if (pc.iceConnectionState === 'connected') {
setMessage('');
}
Expand Down
14 changes: 11 additions & 3 deletions internal/servers/webrtc/read_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,16 @@
.then((offer) => {
offer.sdp = editOffer(offer.sdp);
offerData = parseOffer(offer.sdp);
pc.setLocalDescription(offer);
sendOffer(offer);
pc.setLocalDescription(offer)
.then(() => {
sendOffer(offer);
})
.catch((err) => {
onError(err.toString());
});
})
.catch((err) => {
onError(err.toString());
});
};

Expand All @@ -392,7 +400,7 @@
}

if (pc.iceConnectionState === 'disconnected') {
onError('peer connection disconnected');
onError('peer connection closed');
}
};

Expand Down

0 comments on commit c37e895

Please sign in to comment.