forked from External/mediamtx
webrtc: show error when setLocalDescription or createOffer fail (#3417)
This commit is contained in:
parent
ca6e1259fb
commit
c37e8953fa
2 changed files with 22 additions and 6 deletions
|
|
@ -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('');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue