-
-
Notifications
You must be signed in to change notification settings - Fork 125
AudioChannel
UnknownSKL edited this page Jul 31, 2021
·
3 revisions
The Audio channel only receives data and does not send data to this channel.
Total length: 12-?? bytes
Name | Type | Description |
---|---|---|
Frame ID | UInt32 (4bytes) | Video Frame ID |
Timestamp | UInt32 (4bytes) | Timestamp of the video frame |
Frame size | UInt32 (4bytes) | Unknown |
Frame Data | Bytes (? bytes) | Rest of the packet is the Audio frame data in Opus format |
The example code below shows how the data is read in javascript. The first parameter in getUint32 is the offset. From byte 12 the audio frame data can be read. You need to decode the audio frame data using a libopus
decoder.
var messageBuffer = new DataView(eventData.data);
var frameId = messageBuffer.getUint32(0, true);
var timestamp = (messageBuffer.getUint32(4, true)/10);
var frameSize = messageBuffer.getUint32(8, true);
var offset = 12
var frameBuffer = new Uint8Array(eventData.data, offset)