mirror of
https://github.com/pion/webrtc.git
synced 2025-11-03 01:33:46 +08:00
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:
committed by
Sean DuBois
parent
bb0ac79952
commit
7c8064052e
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user