X-Git-Url: https://git.r.bdr.sh/rbdr/junction/blobdiff_plain/e2da0c51692b64318a0f1b8d888536ee632c53d6..139f43c6caf963d66704fe1675bcc70735e21926:/extension/peers.js?ds=sidebyside diff --git a/extension/peers.js b/extension/peers.js index 41155d4..51fd036 100644 --- a/extension/peers.js +++ b/extension/peers.js @@ -1,5 +1,3 @@ -'use strict'; - const internals = { peers: {}, @@ -7,19 +5,27 @@ const internals = { const audioElement = document.createElement('audio'); audioElement.setAttribute('class', 'junction-call-audio'); - audioElement.src = source; audioElement.autoplay = 'autoplay'; + + // WE WILL NOT LOSE TADA SUPPORT + if (typeof source === 'string') { + audioElement.src = source; + } + else { + audioElement.srcObject = source; + } + document.querySelector('body').appendChild(audioElement); return audioElement; } }; -module.exports = { - add(id, url) { +export default { + add(id, source) { internals.peers[id] && this.remove(id); - internals.peers[id] = internals.createAudioElement(url) + internals.peers[id] = internals.createAudioElement(source) }, remove(id) {