i'm trying to send blob through websocket to make real time video chat, this is just simple few lines for testing, first time works then it stops working and causes
Uncaught (in promise) DOMException: Failed to load because no supported source was found.```
the first blob is working fine then the previous error happens here's my code
function socket(pk) {
const HomeSocket = new WebSocket(
'ws://'
+ window.location.host
+ '/ws/stream'
);
HomeSocket.onmessage = function(e) {
var data = JSON.parse(e.data);
if (! data.id) {
fed = document.createElement('video')
fed.id = data.newUser
container.appendChild(fed)
} else {
fed.src = data.stream
fed.play()
}
};
HomeSocket.onclose = function(e) {
};
var device = navigator.mediaDevices.getUserMedia({audio: true, video:true});
var items = [];
device.then(function(stream) {
var recorder = new window.MediaRecorder(stream);
recorder.start(1000);
recorder.ondataavailable = function(e){
items[0] = e.data
var blob = new Blob(items, {type: 'audio/ogg; codecs=opus'});
const audio_url = window.URL.createObjectURL(blob);
HomeSocket.send(audio_url)
}
})
}