let pc = new RTCPeerConnection();
let dc = pc.createDataChannel("SendFile");
// Replace with your own source object, such as a file handle
let source = null;
dc.bufferedAmountLowThreshold = 65536;
dc.addEventListener("bufferedamountlow", (ev) => {
if (source.position < source.length) {
dc.send(source.readFile(65536));
}
});RTCDataChannel: bufferedamountlow event / notebook
RTCDataChannel: bufferedamountlow event
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
dc.onbufferedamountlow = (ev) => {
if (source.position < source.length) {
dc.send(source.readFile(65536));
}
};