Update all examples with copySessionDescription

copySessionDescription adds a button to all examples that copies the
local Session Description. This makes it easier for users to copy the
values.

Resolves #2092
This commit is contained in:
Roman Romanenko
2022-01-28 01:38:03 +03:00
committed by Sean DuBois
parent bb0ac79952
commit 7c8064052e
22 changed files with 167 additions and 17 deletions

View File

@@ -54,6 +54,21 @@ window.createSession = isPublisher => {
}
}
window.copySDP = () => {
const browserSDP = document.getElementById('localSessionDescription')
browserSDP.focus()
browserSDP.select()
try {
const successful = document.execCommand('copy')
const msg = successful ? 'successful' : 'unsuccessful'
log('Copying SDP was ' + msg)
} catch (err) {
log('Unable to copy SDP ' + err)
}
}
let btns = document.getElementsByClassName('createSessionButton')
for (let i = 0; i < btns.length; i++) {
btns[i].style = 'display: none'