let configuration = myPeerConnection.getConfiguration();
if (configuration.certificates?.length === 0) {
RTCPeerConnection.generateCertificate({
name: "RSASSA-PKCS1-v1_5",
hash: "SHA-256",
modulusLength: 2048,
publicExponent: new Uint8Array([1, 0, 1]),
}).then((cert) => {
configuration.certificates = [cert];
myPeerConnection.setConfiguration(configuration);
});
}RTCPeerConnection: getConfiguration() method / notebook
RTCPeerConnection: getConfiguration() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.