Compare commits

..

2 Commits

Author SHA1 Message Date
jerl 1e40cc1039 stream fix 2024-05-30 00:01:38 -07:00
jerl d687ea7a20 stream fix 2024-05-30 00:01:17 -07:00
2 changed files with 16 additions and 13 deletions

View File

@ -64,12 +64,12 @@ async function stream() {
}); });
}; };
r.onstart = () => { r.onstart = () => {
setTimeout(() => r.state === 'recording' && r.stop(), 100); setTimeout(() => r.state === 'recording' && r.stop(), 500);
}; };
r.start(); r.start();
} }
record(); record();
handle = setInterval(record, 100); handle = setInterval(record, 500);
} }
let audioctx; let audioctx;
@ -114,15 +114,14 @@ function loadStreams() {
render(div, html.node` render(div, html.node`
<button id='streaming' onclick=${stream}>start streaming</button> <button id='streaming' onclick=${stream}>start streaming</button>
<span>stream name:</span> <span>stream name:</span>
<input id='streamname'>`); <input id='streamname' oninput=${event => {
div.children['streamname'].oninput = event => { if (handle)
if (handle) window.emit('stream', {
window.emit('stream', { id: streamid,
id: streamid, thread: window.currentThread.id,
thread: window.currentThread.id, name: event.target.value
name: div.children['streamname'].value });
}); }}>`);
};
} }
div.insertAdjacentHTML('beforeend', ` div.insertAdjacentHTML('beforeend', `
<p>streams:</p> <p>streams:</p>

View File

@ -60,7 +60,7 @@ async function stream(msg, respond, socket) {
stream = { stream = {
id: newstreamid++, id: newstreamid++,
thread: msg.thread, thread: msg.thread,
user: msg.auth_user.name, user: msg.auth_user.displayname,
name: msg.name name: msg.name
}; };
thread.streams.push(stream); thread.streams.push(stream);
@ -98,7 +98,11 @@ async function streamdata(msg, respond) {
}); });
} }
for (let id in stream.listeners) for (let id in stream.listeners)
stream.listeners[id].emit('streamdata', msg); stream.listeners[id].emit('streamdata', {
id: msg.id,
audio: msg.audio,
video: msg.video
});
respond({ respond({
success: true success: true
}); });