Skip to content

Commit

Permalink
すまないレースだった
Browse files Browse the repository at this point in the history
  • Loading branch information
voluntas committed Feb 21, 2024
1 parent b64bfc3 commit df74106
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions examples/e2ee/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ sendrecv.on('removetrack', (event) => {
}
})
sendrecv.on('notify', (event) => {
if (event.event_type === 'connection.created' && event.connection_id === sendrecv.connectionId) {
document.querySelector('#local-connection-id').textContent =
`connectionId: ${sendrecv.connectionId}`
document.querySelector('#local-fingerprint').textContent =
`fingerprint: ${sendrecv.e2eeSelfFingerprint}`

return
}

if (event.event_type === 'connection.created') {
const remoteFingerprints = sendrecv.e2eeRemoteFingerprints
// biome-ignore lint/complexity/noForEach: <explanation>
Expand All @@ -72,10 +81,6 @@ sendrecv.on('notify', (event) => {
document.querySelector('#start-sendrecv').addEventListener('click', async () => {
const mediaStream = await navigator.mediaDevices.getUserMedia({ audio: true, video: true })
await sendrecv.connect(mediaStream)
document.querySelector('#local-connection-id').textContent =
`connectionId: ${sendrecv.connectionId}`
document.querySelector('#local-fingerprint').textContent =
`fingerprint: ${sendrecv.e2eeSelfFingerprint}`
document.querySelector('#sendrecv-local-video').srcObject = mediaStream
})

Expand Down

0 comments on commit df74106

Please sign in to comment.