RTCPeerConnection-sender-worker-single-frame.js (630B)
1 onmessage = async (event) => { 2 const readableStream = event.data.readableStream; 3 const reader = readableStream.getReader(); 4 const result = await reader.read(); 5 6 // Post an object with individual fields so that the test side has 7 // values to verify the serialization of the RTCEncodedVideoFrame. 8 postMessage({ 9 type: result.value.type, 10 timestamp: result.value.timestamp, 11 data: result.value.data, 12 metadata: result.value.getMetadata(), 13 }); 14 15 // Send the frame twice to verify that the frame does not change after the 16 // first serialization. 17 postMessage(result.value); 18 postMessage(result.value); 19 }