import { Signal } from "@moq/signals"; import { Group } from "./group"; /** Reactive backing state for a {@link Track}: buffered groups, a closed flag, and the subscription priority. */ export declare class TrackState { groups: Signal; closed: Signal; priority: Signal; } /** A live stream of groups within a broadcast, identified by name. */ export declare class Track { #private; /** Name of this track within its broadcast. */ readonly name: string; /** Reactive backing state. */ state: TrackState; /** Resolves with the abort error (or undefined) once closed. */ readonly closed: Promise; constructor(name: string); /** * Appends a new group to the track. * @returns A GroupProducer for the new group */ appendGroup(): Group; /** * Inserts an existing group into the track. * @param group - The group to insert */ writeGroup(group: Group): void; /** * Appends a frame to the track in its own group. * * @param frame - The frame to append */ writeFrame(frame: Uint8Array): void; /** Appends a string to the track as its own single-frame group. */ writeString(str: string): void; /** Appends a JSON value to the track as its own single-frame group. */ writeJson(json: unknown): void; /** Appends a boolean to the track as its own single-frame group. */ writeBool(bool: boolean): void; /** * Receive the next group available on this track, in arrival order. * * Groups may arrive out of order or with gaps due to network conditions. * Use {@link nextGroupOrdered} if you need groups in sequence order, * skipping those that arrive too late. */ recvGroup(): Promise; /** * @deprecated Use {@link recvGroup} for arrival order, or {@link nextGroupOrdered} for sequence order. */ nextGroup(): Promise; /** * Return the next group with a strictly-greater sequence number than the last returned. * * Late arrivals (with a sequence number at or below the last one returned) are silently skipped. * * NOTE: This will be renamed to `nextGroup` in the next major version. */ nextGroupOrdered(): Promise; /** Reads the next frame across all groups, discarding older groups. */ readFrame(): Promise; /** Reads the next frame along with its group and frame sequence numbers. */ readFrameSequence(): Promise<{ group: number; frame: number; data: Uint8Array; } | undefined>; /** Reads the next frame and decodes it as a UTF-8 string. */ readString(): Promise; /** Reads the next frame and parses it as JSON. */ readJson(): Promise; /** Reads the next frame and decodes it as a one-byte boolean, throwing on a malformed frame. */ readBool(): Promise; /** * Update the subscription priority. Triggers a SUBSCRIBE_UPDATE * to the publisher when used on a subscribed track. */ updatePriority(priority: number): void; /** * Closes the publisher and all associated groups. */ close(abort?: Error): void; } //# sourceMappingURL=track.d.ts.map