-'use strict';
-
const internals = {
peers: {},
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) {