]> git.r.bdr.sh - rbdr/junction/commitdiff
Use source and support srcObject rbdr-peer-abstraction
authorRuben Beltran del Rio <redacted>
Wed, 7 Oct 2020 20:06:32 +0000 (22:06 +0200)
committerRuben Beltran del Rio <redacted>
Wed, 7 Oct 2020 20:06:32 +0000 (22:06 +0200)
extension/peers.js

index 41155d414edac7452a91970b03ed1b4393a5e726..2d74fad724c401f5dec84713e506225c48db8b9b 100644 (file)
@@ -7,8 +7,16 @@ const internals = {
 
     const audioElement = document.createElement('audio');
     audioElement.setAttribute('class', 'junction-call-audio');
 
     const audioElement = document.createElement('audio');
     audioElement.setAttribute('class', 'junction-call-audio');
-    audioElement.src = source;
     audioElement.autoplay = 'autoplay';
     audioElement.autoplay = 'autoplay';
+
+    // WE WILL NOT LOSE TADA SUPPORT
+    if (typeof source === 'string') {
+      audioElement.src = source;
+    }
+    else {
+      audoElement.srcObject = source;
+    }
+
     document.querySelector('body').appendChild(audioElement);
 
     return audioElement;
     document.querySelector('body').appendChild(audioElement);
 
     return audioElement;
@@ -16,10 +24,10 @@ const internals = {
 };
 
 module.exports = {
 };
 
 module.exports = {
-  add(id, url) {
+  add(id, source) {
 
     internals.peers[id] && this.remove(id);
 
     internals.peers[id] && this.remove(id);
-    internals.peers[id] = internals.createAudioElement(url)
+    internals.peers[id] = internals.createAudioElement(source)
   },
 
   remove(id) {
   },
 
   remove(id) {