1
0
Fork 0
forked from External/mediamtx

webrtc: show error when setLocalDescription or createOffer fail (#3417)

This commit is contained in:
Alessandro Ros 2024-06-02 23:19:58 +02:00 committed by GitHub
parent ca6e1259fb
commit c37e8953fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 6 deletions

View file

@ -480,8 +480,16 @@ const createOffer = () => {
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());
});
};
@ -491,7 +499,7 @@ const onConnectionState = () => {
}
if (pc.iceConnectionState === 'disconnected') {
onError('peer connection disconnected', true);
onError('peer connection closed', true);
} else if (pc.iceConnectionState === 'connected') {
setMessage('');
}

View file

@ -381,8 +381,16 @@ const createOffer = () => {
.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());
});
};
@ -392,7 +400,7 @@ const onConnectionState = () => {
}
if (pc.iceConnectionState === 'disconnected') {
onError('peer connection disconnected');
onError('peer connection closed');
}
};