blob: 03ba1f4ee6e0976a68d607de9824d2fd23daacd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
onrtctransform = (event) => {
const transformer = event.transformer;
transformer.reader = transformer.readable.getReader();
transformer.writer = transformer.writable.getWriter();
let isFirstFrame = true;
function process(transformer)
{
transformer.reader.read().then(chunk => {
if (chunk.done)
return;
if (isFirstFrame) {
isFirstFrame = false;
self.postMessage({ name: transformer.options.name, timestamp: chunk.value.timestamp, metadata: chunk.value.getMetadata() });
}
transformer.writer.write(chunk.value);
process(transformer);
});
}
process(transformer);
};
self.postMessage("registered");
|