sinch-rtc
Version:
RTC JavaScript/Web SDK
65 lines (64 loc) • 2.21 kB
TypeScript
import { INBOUND_RTP_AUDIO_STATS, INBOUND_RTP_VIDEO_STATS, OUTBOUND_RTP_AUDIO_STATS, OUTBOUND_RTP_VIDEO_STATS } from "./WebRTCStatsCollector";
export declare enum RtcStatsTypes {
CandidatePair = "candidate-pair",
Codec = "codec",
InboundRtp = "inbound-rtp",
MediaSource = "media-source",
OutboundRtp = "outbound-rtp",
RemoteCandidate = "remote-candidate",
LocalCandidate = "local-candidate",
Track = "track",
RemoteInboundRtp = "remote-inbound-rtp"
}
export declare enum MediaType {
Audio = "audio",
Video = "video"
}
export interface StatsReport {
id: string;
mediaType: MediaType;
names: RtpProps[];
type: MediaStatsTypes;
values: Array<Array<number | string>>;
}
export interface RawStats {
mediaSource: Map<string, RTCAudioSourceStats>;
codec: Map<string, CodecStats>;
candidatePair: CandidatePairStats;
tracks: Map<string, Record<string, unknown>>;
}
export interface CodecStats {
codecId: string;
mimeType: string;
}
export interface CandidatePairStats extends RTCIceCandidatePairStats {
priority?: number;
writable?: boolean;
packetsSent?: number;
packetsReceived?: number;
consentRequestsSent?: number;
packetsDiscardedOnSend?: number;
bytesDiscardedOnSend?: number;
}
export interface Candidate extends RTCStats {
candidateType: RTCIceCandidateType;
timestamp: number;
address?: string;
port: number;
protocol: RTCIceProtocol;
relayProtocol?: string;
url?: string;
}
export interface RTCAudioSourceStats {
audioLevel: number;
totalSamplesDuration: number;
}
export type RtpProps = typeof INBOUND_RTP_AUDIO_STATS[number] | typeof INBOUND_RTP_VIDEO_STATS[number] | typeof OUTBOUND_RTP_AUDIO_STATS[number] | typeof OUTBOUND_RTP_VIDEO_STATS[number];
export type MediaStatsTypes = Exclude<RtcStatsTypes, RtcStatsTypes.MediaSource | RtcStatsTypes.Track | RtcStatsTypes.CandidatePair | RtcStatsTypes.Codec | RtcStatsTypes.RemoteCandidate | RtcStatsTypes.LocalCandidate | RtcStatsTypes.RemoteInboundRtp>;
export type RtcMediaTypeMapping = {
[key in MediaStatsTypes]: {
[key in MediaType]: {
STATS: RtpProps[];
};
};
};