Home

negotiationneeded

Negotiationneeded is an event in the WebRTC API that is fired on an RTCPeerConnection to indicate that renegotiation of the session description is required. It signals that pending changes to the connection, such as modifications to tracks or transceivers, require updating the local or remote session descriptions.

When this event is emitted, the application typically starts a signaling round to renegotiate the connection.

Negotiationneeded is often triggered by changes that affect the signaling state, such as adding or removing

To avoid negotiation conflicts and loops (glare), developers typically serialize negotiations with a guard flag or

See also: WebRTC, RTCPeerConnection, signaling, offer/answer model.

The
common
flow
is
to
create
an
offer,
set
the
local
description,
and
transmit
the
offer
to
the
remote
peer.
The
remote
peer
then
sets
the
received
offer
as
its
remote
description,
creates
an
answer,
sets
its
local
description,
and
sends
the
answer
back.
The
initiating
side
completes
the
process
by
setting
the
remote
description
with
the
received
answer.
This
pattern
allows
both
peers
to
agree
on
the
updated
media
configuration.
tracks
via
addTrack,
replacing
a
track
with
replaceTrack,
or
other
changes
that
require
updating
the
session
description.
Implementations
normally
fire
this
event
only
after
such
changes,
and
not
for
the
initial
offer/answer
exchange
that
occurs
at
connection
setup,
which
is
usually
initiated
manually
by
the
application.
a
queue,
ensuring
only
one
negotiation
is
in
progress
at
a
time.
Some
applications
also
debounce
or
coalesce
multiple
changes
before
starting
renegotiation.