node-datachannel
Version:
WebRTC For Node.js and Electron. libdatachannel node bindings.
42 lines (35 loc) • 1.1 kB
text/typescript
// https://developer.mozilla.org/docs/Web/API/RTCSessionDescription
//
// Example usage
// const init = {
// type: 'offer',
// sdp: 'v=0\r\no=- 1234567890 1234567890 IN IP4 192.168.1.1\r\ns=-\r\nt=0 0\r\na=ice-ufrag:abcd\r\na=ice-pwd:efgh\r\n'
// };
export default class RTCSessionDescription implements globalThis.RTCSessionDescriptionInit {
constructor(init: globalThis.RTCSessionDescriptionInit) {
this.
this.
}
get type(): globalThis.RTCSdpType {
return this.
}
set type(type) {
if (type !== 'offer' && type !== 'answer' && type !== 'pranswer' && type !== 'rollback') {
throw new TypeError(
`Failed to set the 'type' property on 'RTCSessionDescription': The provided value '${type}' is not a valid enum value of type RTCSdpType.`,
);
}
this.
}
get sdp(): string {
return this.
}
toJSON(): globalThis.RTCSessionDescriptionInit {
return {
sdp: this.
type: this.
};
}
}