npaw-plugin-nwf
Version:
NPAW's Plugin
305 lines (304 loc) • 7.84 kB
TypeScript
export declare const Services: {
CDN: string;
};
/**
* Websocket events
*/
export declare const Events: {
Get: {
Success: string;
Fail: string;
Progress: string;
};
};
/**
* Segment object load events
*/
export declare const SegmentEvent: {
Success: string;
Fail: string;
Progress: string;
};
/**
* Loader object load events
*/
export declare const LoaderEvent: {
Updated: string;
Success: string;
Fail: string;
};
/**
* Balancer API url
*/
export declare const Balancer: {
host: string;
devHost: string;
devDomains: string[];
service: string;
decisionCallWaitTime: number;
decisionReloadIntervalPerManifestMilliseconds: number;
};
/**
* File extensions we identify as video, excluding manifests, subtitles and audio
*/
export declare const VideoExtensions: string[];
/**
* File extensions we identify as manifests, excluding video, subtitles and audio
*/
export declare const ManifestExtensions: string[];
/**
* File extensions we identify as audio, excluding manifests, subtitles and video
*/
export declare const AudioExtensions: string[];
/**
* File extensions we identify as subtitles, excluding video, manifests and audio
*/
export declare const SubtitleExtensions: string[];
/**
* Peer events
*/
export declare const PeerEvent: {
connect: string;
close: string;
error: string;
data: string;
ping: string;
pong: string;
};
/**
* CDN switch methods/algorithms
*/
export declare const SyntheticCdn: {
readonly BYPASS: "BYPASS";
readonly BLACKLIST: "BLACKLIST";
readonly ORIGIN: "ORIGIN";
};
export type SyntheticCdnKind = (typeof SyntheticCdn)[keyof typeof SyntheticCdn];
export declare const SyntheticCdnProviderName: {
BYPASS: string;
BLACKLIST: string;
ORIGIN: string;
};
/**
* Parity with Android SyntheticCdnEntry (BalancerStats.kt:247-269).
* All fields are deltas per ping window; reset by consumeSyntheticCdnStats.
*/
export type SyntheticCdnStats = {
downloadedChunks: number;
downloadedBytes: number;
time: number;
sumResponseBytes?: number;
minResponseBytes?: number;
maxResponseBytes?: number;
responseBytesSamples?: number;
sumResponseTime?: number;
minResponseTime?: number;
maxResponseTime?: number;
responseTimeSamples?: number;
sumThroughput?: number;
minThroughput?: number;
maxThroughput?: number;
throughputSamples?: number;
http1xx?: number;
http2xx?: number;
http3xx?: number;
http4xx?: number;
http5xx?: number;
errors?: number;
};
export declare function emptySyntheticCdnStats(): SyntheticCdnStats;
export declare const SwitchMethod: {
optimizedScore: string;
optimizedFeedback: string;
bestScore: string;
qualityPriority: string;
cdnPriority: string;
none: string;
};
/**
* Limit of bits for cdn priority switching method
*/
export declare const CdnPriorityLimits: {
max: number;
min: number;
default: number;
};
/**
* CDN fallback methods
*/
export declare const FallbackMethod: {
random: string;
default: string;
};
/**
* Peer commands
*/
export declare const PeerCommand: {
data: string;
absent: string;
map: string;
newSegmentAvailable: string;
segmentState: string;
request: string;
cancel: string;
ping: string;
pong: string;
};
/**
* State of a segment in a peer's remote cache (wire-compatible with Android/iOS v2 protocol).
*/
export declare const SegmentState: {
ACQUIRING: string;
READY: string;
FAILED: string;
EVICTED: string;
UNKNOWN: string;
};
/**
* Role of the local peer in the leader election for a given segment
* (wire-compatible with Android/iOS v2 protocol).
*/
export declare const SegmentLeaderRole: {
NONE: string;
PRIMARY: string;
BACKUP: string;
};
/**
* Exponential moving average configuration for per-peer transfer speed tracking.
* Parity with iOS `Peer.swift` / Android `PeerManager.kt`.
*/
export declare const P2PTransferSpeed: {
emaAlpha: number;
minSamplesForSpeed: number;
};
/**
* Key names for the commands between peers
*/
export declare const PeerKey: {
command: string;
id: string;
size: string;
storageSize: string;
map: string;
identifier: string;
splits: string;
time: number;
simpleMapKeys: string;
simpleMapSize: string;
dateTime: string;
createdAt: string;
state: string;
role: string;
leaseMs: string;
};
/**
* Data prefixes for messages between peers
*/
export declare const Prefix: {
bandwidth_test: number;
message: number;
data: number;
};
/**
* P2P static settings
*/
export declare const P2PDefaultSettings: {
maxMessageSize: number;
probability: number;
timeout: number;
maxConcurrency: number;
maxConnectedPeers: number;
tracker: string;
upload: boolean;
};
/**
* P2P static settings
*/
export declare const P2PProtocolVersion: {
version: number;
};
/**
* Storage settings
*/
export declare const Storage: {
expiration: number;
count: number;
safeMaxCount: number;
};
/**
* Cdn static settings.
*
* Timeouts mirror the Android four-timeout model (CdnTimeoutSettings):
* connectTimeoutMilliseconds — DNS + TCP + TLS (cleared on HEADERS_RECEIVED).
* readTimeoutMilliseconds — between socket reads, re-armed on every progress tick.
* callTimeoutMilliseconds — headers + body of one attempt (XHR-native xhr.timeout).
* totalTimeoutMilliseconds — whole connection of one attempt; resets per provider hop.
*
* Any value <= 0 means "no deadline" (timer is not armed). `requestTimeoutMilliseconds`
* is kept as a legacy alias for `callTimeoutMilliseconds` and is mirrored whenever the
* latter is updated.
*/
export declare const CDNDefaultSettings: {
retries: number;
retryDelay: number;
defaultBwThreshold: number;
connectTimeoutMilliseconds: number;
readTimeoutMilliseconds: number;
callTimeoutMilliseconds: number;
totalTimeoutMilliseconds: number;
requestTimeoutMilliseconds: number;
minRequestSizeForBwEstimateKB: number;
};
/**
* Stats calculation settings
*/
export declare const StatsSettings: {
totalDataInterval: number;
};
/**
* Latency Probing
*/
export declare const LatencyProbing: {
callTimeoutMilliseconds: number;
timeBetweenCallsMilliseconds: number;
timeBetweenBurstsMilliseconds: number;
};
/**
* CDN Probing
*/
export declare const CDNProbing: {
lastMeasurementWeight: number;
maximumRelativeDeltaForTrial: number;
minimumDurationSinceLastUsedForTrialMilliseconds: number;
chunkExpirationProbingMs: number;
probingPolicy: string;
};
/**
* Latency-trial-trigger thresholds (Android LatencyTrialTriggerSettings).
* A CDN's trial cooldown is bypassed when its latency EMA has improved by at
* least `minRelativeImprovement` AND `minAbsoluteImprovementMs` against the
* snapshot captured at its last trial.
*/
export declare const LatencyTrialTrigger: {
minRelativeImprovement: number;
minAbsoluteImprovementMs: number;
emaAlpha: number;
};
/**
* Trial-selection settings (Android `TrialSettings`, `plugin-android@a6dc9b66`).
*
* `onlyForVideoSegments`: when true (default) only media segments are
* eligible to consume the trial slot. Audio / init / manifest fetches are
* too small to produce meaningful bandwidth signal and would burn the
* per-CDN cooldown without paying it back. Set to false to retain the
* pre-PR10 behaviour where any segment can trigger a trial.
*/
export declare const Trial: {
onlyForVideoSegments: boolean;
};
export declare const enum CdnRequestStatus {
SUCESS = 0,
FAILED_DUE_TO_ERROR = 1,
FAILED_DUE_TO_CONNECTIVITY = 2,
FAILED_DUE_TO_QUALITY = 3
}