/**
* Copyright 2018 Novage LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
///
import { EventEmitter } from "events";
import { LoaderInterface, Segment } from "./loader-interface";
export declare class HybridLoader extends EventEmitter implements LoaderInterface {
private readonly debug;
private readonly debugSegments;
private readonly httpManager;
private readonly p2pManager;
private segmentsStorage;
private segmentsQueue;
private readonly bandwidthApproximator;
private readonly settings;
private httpRandomDownloadInterval;
private httpDownloadInitialTimeoutTimestamp;
private masterSwarmId?;
static isSupported: () => boolean;
constructor(settings?: Partial);
private createHttpManager;
private createP2PManager;
load: (segments: Segment[], streamSwarmId: string) => Promise;
getSegment: (id: string) => Promise;
getSettings: () => HybridLoaderSettings;
getDetails: () => {
peerId: string;
};
getBandwidthEstimate: () => number;
destroy: () => Promise;
private processInitialSegmentTimeout;
private processSegmentsQueue;
private downloadRandomSegmentOverHttp;
private onPieceBytesDownloaded;
private onPieceBytesUploaded;
private onSegmentLoaded;
private onSegmentError;
private getStreamSwarmId;
private createSegmentsMap;
private onPeerConnect;
private onPeerClose;
private onTrackerUpdate;
private cleanSegmentsStorage;
private now;
}
export interface SegmentsStorage {
storeSegment: (segment: Segment) => Promise;
getSegmentsMap: (masterSwarmId: string) => Promise