Compare commits
2 Commits
84563d1829
...
1e40cc1039
Author | SHA1 | Date |
---|---|---|
jerl | 1e40cc1039 | |
jerl | d687ea7a20 |
|
@ -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: div.children['streamname'].value
|
name: event.target.value
|
||||||
});
|
});
|
||||||
};
|
}}>`);
|
||||||
}
|
}
|
||||||
div.insertAdjacentHTML('beforeend', `
|
div.insertAdjacentHTML('beforeend', `
|
||||||
<p>streams:</p>
|
<p>streams:</p>
|
||||||
|
|
|
@ -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
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue