RTCErrorEvent: RTCErrorEvent() constructor
Baseline
2026
Newly available
Since April 2026, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Note: This feature is available in Web Workers.
The RTCErrorEvent() constructor creates a new RTCErrorEvent object.
Note that you will not normally create an object of this type yourself.
Syntax
js
new RTCErrorEvent(type, options)
Parameters
Return value
A new RTCErrorEvent object.
Examples
>Basic usage
This example shows how you might create an RTCErrorEvent instance.
js
// Construct an RTCError (used to initialize the event)
const rtcError = new RTCError(
{
errorDetail: "sdp-syntax-error",
sdpLineNumber: 42,
},
"SDP syntax error on line 42",
);
// Construct the RTCErrorEvent, passing the RTCError
const event = new RTCErrorEvent("error", {
error: rtcError, // required
bubbles: true, // Optional (inherited from Event)
cancelable: false, // Optional (inherited from Event)
});
Specifications
| Specification |
|---|
| WebRTC: Real-Time Communication in Browsers> # dom-rtcerrorevent-constructor> |