p2p-media-loader-core
Version:
P2P Media Loader core functionality
45 lines (44 loc) • 2.08 kB
TypeScript
import { CoreEventMap, EngineCallbacks, SegmentWithStream, StreamConfig, StreamWithSegments } from "./types.js";
import { BandwidthCalculators, StreamDetails } from "./internal-types.js";
import { EventTarget } from "./utils/event-target.js";
import { SegmentStorage } from "./segment-storage/index.js";
export declare class HybridLoader {
private streamManifestUrl;
private lastRequestedSegment;
private readonly streamDetails;
private readonly config;
private readonly bandwidthCalculators;
private readonly segmentStorage;
private readonly eventTarget;
private readonly requests;
private engineRequest?;
private readonly p2pLoaders;
private readonly playback;
private readonly segmentAvgDuration;
private readonly logger;
private storageCleanUpIntervalId?;
private levelChangedTimestamp?;
private lastQueueProcessingTimeStamp?;
private randomHttpDownloadInterval?;
private isProcessQueueMicrotaskCreated;
constructor(streamManifestUrl: string, lastRequestedSegment: Readonly<SegmentWithStream>, streamDetails: Required<Readonly<StreamDetails>>, config: StreamConfig, bandwidthCalculators: BandwidthCalculators, segmentStorage: SegmentStorage, eventTarget: EventTarget<CoreEventMap>);
private setIntervalLoading;
loadSegment(segment: Readonly<SegmentWithStream>, callbacks: EngineCallbacks): Promise<void>;
private requestProcessQueueMicrotask;
private processRequests;
private processQueue;
abortSegmentRequest(segmentRuntimeId: string): void;
private loadThroughHttp;
private loadThroughP2P;
private loadRandomThroughHttp;
private abortLastHttpLoadingInQueueAfterItem;
private abortLastP2PLoadingInQueueAfterItem;
private getAvailableStorageCapacityPercent;
private generateQueue;
private getBandwidth;
notifyLevelChanged(): void;
sendBroadcastAnnouncement(sendEmptySegmentsAnnouncement?: boolean): void;
updatePlayback(position: number, rate: number): void;
updateStream(stream: StreamWithSegments): void;
destroy(): void;
}