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

View File

@ -60,7 +60,7 @@ async function stream(msg, respond, socket) {
stream = {
id: newstreamid++,
thread: msg.thread,
user: msg.auth_user.name,
user: msg.auth_user.displayname,
name: msg.name
};
thread.streams.push(stream);
@ -98,7 +98,11 @@ async function streamdata(msg, respond) {
});
}
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({
success: true
});