'using capturestream() instead of navigator.mediadevices.getusermedia()

im using the google codelabs code to connect peers and change media between them, instead of the getusermedia i want to send the music from a mp3 url. so instead of GetuserMedia i used capturestream() but im getting errors, the code is attached bellow.

 function makezastream() {
  return new Promise(function (resolve, reject) {
    var audio = new Audio("http://streaming.radiodancefloor.it:80/dancefloor.mp3");
    const stream = audio.captureStream();
    console.log("here in makezastream less see what we hae",stream)
    resolve(stream);
    
  });
}

makezastream().then(gotStream)
.catch(function(e) {
  alert('getUserMedia() error: ' + e.name);
});


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source