blob: 333ad8d444683fbe7dc2f371e6015f7a6618d595 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<script>
var timeout = async function (cmd) {
const timer = new Promise((resolve, reject) => {
const id = setTimeout(() => {
clearTimeout(id)
reject(new Error('Promise timed out!'))
}, 750)
})
return Promise.race([cmd, timer])
}
window.addEventListener('load', async () => {
let a = new RTCPeerConnection({
'iceServers': [{'urls': 'stun:23.21.150.121'}],
'peerIdentity': 'x',
})
let b = await timeout(a.createOffer({ }))
a.setLocalDescription(b)
try { a.setRemoteDescription(b) } catch (e) {}
a.setLocalDescription(b)
})
</script>
|