Skip to content

@seydx/rtsp / requireAvPacket

Function: requireAvPacket()

requireAvPacket(packet): Packet

Defined in: av-packet.ts:81

Narrow a media packet to its underlying node-av packet.

Recovers the native node-av handle carried by an AV-backed MediaPacket. Sinks that operate on native packets (muxers, encoders, AV-aware writers) use this to assert that the packet originated from an AV source rather than a plain JavaScript packet, and to obtain the handle in a single, strongly typed step.

Parameters

packet

MediaPacket

The media packet to narrow

Returns

Packet

The underlying native node-av packet

Throws

If the packet carries no native handle (i.e. it came from a non-AV source)

Example

typescript
import { requireAvPacket } from '@seydx/rtsp';

const native = requireAvPacket(media);
await muxer.writePacket(native);

See