UNPKG

active-switching

Version:

NPAW's SDK for CDN Balancing and P2P

54 lines (53 loc) 2.15 kB
import Interceptors from './Interceptors/Interceptors'; import Options from './Utils/Options'; import Loader from './Loaders/Loader'; import Emitter from './Utils/Emitter'; import { VideoSegment } from './Storage/VideoSegment'; /** * @class * @description Core class for the p2p plugin. It includes the options, the websocket communication, * @exports CdnBalancer */ export default class CdnBalancer extends Emitter { private loader; interceptors: Interceptors; options: Options; private isEnabled; private defaultChunkDownloadTimeout; /** * Constructs CdnBalancer. * @param {constructionOptions} constructionOptions JSON with the options to construct the balancer. */ constructor(constructionOptions: constructionOptions); private resolv; private openAndSend; /** * Redirects adapter's requests to loader. * If loader is not ready yet it retries again after 200ms. * @param {URL} url URL object for the request. * @param {callback} callback Callback method to call back when loaded. * @param {Object} headers Optional headers of the request. * @param {number} retries Number of retries before giving up to load a segment if it fails, optional. * @param {boolean} forceArrayBuffer set as true if is expected to get the manifest response in ArrayBuffer format. * @public */ request(url: URL, download: true, callbacks: callback[], headers: { [key: string]: string; }, retries?: number, forceArrayBuffer?: boolean, stats?: fragStats): void; /** * Sets the manifest URL of the played content to the options object. * For url changes the loader is restarted. * @param {string} url Manifest url of the content being played. * @public */ setManifestResource(url: string): void; getLoader(): Loader; addInterceptor(name: string, player: any): void; simpleRequest(urlString: string, params: any, headers: { [key: string]: string; }): VideoSegment; enable(): void; disable(): void; getIsEnabled(): boolean; reload(constructionOptions?: constructionOptions): void; }