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()
|
pc.createOffer()
|
||||||
.then((offer) => {
|
.then((offer) => {
|
||||||
offerData = parseOffer(offer.sdp);
|
offerData = parseOffer(offer.sdp);
|
||||||
pc.setLocalDescription(offer);
|
pc.setLocalDescription(offer)
|
||||||
sendOffer(offer.sdp);
|
.then(() => {
|
||||||
|
sendOffer(offer.sdp);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
onError(err.toString());
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
onError(err.toString());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -491,7 +499,7 @@ const onConnectionState = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pc.iceConnectionState === 'disconnected') {
|
if (pc.iceConnectionState === 'disconnected') {
|
||||||
onError('peer connection disconnected', true);
|
onError('peer connection closed', true);
|
||||||
} else if (pc.iceConnectionState === 'connected') {
|
} else if (pc.iceConnectionState === 'connected') {
|
||||||
setMessage('');
|
setMessage('');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -381,8 +381,16 @@ const createOffer = () => {
|
||||||
.then((offer) => {
|
.then((offer) => {
|
||||||
offer.sdp = editOffer(offer.sdp);
|
offer.sdp = editOffer(offer.sdp);
|
||||||
offerData = parseOffer(offer.sdp);
|
offerData = parseOffer(offer.sdp);
|
||||||
pc.setLocalDescription(offer);
|
pc.setLocalDescription(offer)
|
||||||
sendOffer(offer);
|
.then(() => {
|
||||||
|
sendOffer(offer);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
onError(err.toString());
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
onError(err.toString());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -392,7 +400,7 @@ const onConnectionState = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pc.iceConnectionState === 'disconnected') {
|
if (pc.iceConnectionState === 'disconnected') {
|
||||||
onError('peer connection disconnected');
|
onError('peer connection closed');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue