Function: readEmsg()
ts
function readEmsg<V>(cursor): EventMessageBox<V>;Defined in: readers/readEmsg.ts:31
Read the emsg box (EventMessageBox).
The 64-bit integer fields of the result have the type that the int64 function of the cursor returns. With no option, they are numbers.
ISO/IEC 23009-1:2022 - 5.10.3.3
For a version other than 0 or 1, messageData holds all bytes after the full box fields. The strings of the result are empty, the numbers are 0, and both time fields are undefined.
Type Parameters
V
V extends IsoInt64
Parameters
cursor
The read cursor at the first byte after the box header
Returns
A parsed EventMessageBox
Example
ts
const isoFile = await readFile(new URL('../fixtures/emsg.m4s', import.meta.url))
const boxes = readIsoBoxes(isoFile, { readers: { emsg: readEmsg } })
const box = findIsoBox(boxes, box => isIsoBoxType('emsg', box))
// A version 0 box has a presentation time delta, and a version 1 box has a presentation time.
const time = box?.presentationTimeDelta ?? box?.presentationTime