Telegram Web K with changes to work inside I2P
https://web.telegram.i2p/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.3 KiB
43 lines
1.3 KiB
/* |
|
* https://github.com/morethanwords/tweb |
|
* Copyright (C) 2019-2021 Eduard Kuzmenko |
|
* https://github.com/morethanwords/tweb/blob/master/LICENSE |
|
*/ |
|
|
|
import { Logger, logger } from "../../logger"; |
|
|
|
export default function createPeerConnection(config: RTCConfiguration, log?: Logger) { |
|
if(!log) { |
|
log = logger('RTCPeerConnection'); |
|
} |
|
|
|
log('constructor'); |
|
|
|
// @ts-ignore |
|
const connection = new RTCPeerConnection(config); |
|
connection.addEventListener('track', (event) => { |
|
log('ontrack', event); |
|
}); |
|
connection.addEventListener('signalingstatechange', () => { |
|
log('onsignalingstatechange', connection.signalingState); |
|
}); |
|
connection.addEventListener('connectionstatechange', () => { |
|
log('onconnectionstatechange', connection.connectionState); |
|
}); |
|
connection.addEventListener('negotiationneeded', () => { // * will be fired every time input device changes |
|
log('onnegotiationneeded', connection.signalingState); |
|
}); |
|
connection.addEventListener('icecandidate', (event) => { |
|
log('onicecandidate', event); |
|
}); |
|
connection.addEventListener('iceconnectionstatechange', () => { |
|
log('oniceconnectionstatechange', connection.iceConnectionState); |
|
}); |
|
connection.addEventListener('datachannel', () => { |
|
log('ondatachannel'); |
|
}); |
|
|
|
connection.log = log; |
|
|
|
return {connection}; |
|
}
|
|
|