pc.addEventListener("negotiationneeded", (ev) => {
pc.createOffer()
.then((offer) => pc.setLocalDescription(offer))
.then(() =>
sendSignalingMessage({
type: "video-offer",
sdp: pc.localDescription,
}),
)
.catch((err) => {
// handle error
});
});RTCPeerConnection: negotiationneeded event / notebook
RTCPeerConnection: negotiationneeded event
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
pc.onnegotiationneeded = (ev) => {
pc.createOffer()
.then((offer) => pc.setLocalDescription(offer))
.then(() =>
sendSignalingMessage({
type: "video-offer",
sdp: pc.localDescription,
}),
)
.catch((err) => {
// handle error
});
};