declare const VERSION: string; export interface AnalyticsDebugConfig { fields?: string[]; } export interface CollectorConfig { backendUrl?: string; enabled?: boolean; cookiesEnabled?: boolean; cookiesDomain?: string; origin?: string; } export interface AnalyticsConfig { debug?: boolean | AnalyticsDebugConfig; key?: string; playerKey?: string; player?: string; cdnProvider?: string; videoId?: string; title?: string; userId?: string; customUserId?: string; customData1?: any; customData2?: any; customData3?: any; customData4?: any; customData5?: any; customData6?: any; customData7?: any; customData8?: any; customData9?: any; customData10?: any; customData11?: any; customData12?: any; customData13?: any; customData14?: any; customData15?: any; customData16?: any; customData17?: any; customData18?: any; customData19?: any; customData20?: any; customData21?: any; customData22?: any; customData23?: any; customData24?: any; customData25?: any; customData26?: any; customData27?: any; customData28?: any; customData29?: any; customData30?: any; experimentName?: string; isLive?: boolean; config?: CollectorConfig; } export interface CustomDataValues { customData1?: string; customData2?: string; customData3?: string; customData4?: string; customData5?: string; customData6?: string; customData7?: string; customData8?: string; customData9?: string; customData10?: string; customData11?: string; customData12?: string; customData13?: string; customData14?: string; customData15?: string; customData16?: string; customData17?: string; customData18?: string; customData19?: string; customData20?: string; customData21?: string; customData22?: string; customData23?: string; customData24?: string; customData25?: string; customData26?: string; customData27?: string; customData28?: string; customData29?: string; customData30?: string; experimentName?: string; } export interface AdapterAPI { getCurrentImpressionId: () => string | undefined; getUserId: () => string | undefined; setCustomData: (values: CustomDataValues) => void; setCustomDataOnce: (values: CustomDataValues) => void; sourceChange: (config: AnalyticsConfig) => void; } export interface AnalyticsStateMachineOptions { starttime: any; } declare class QualityChangeService { private qualityChangeThreshold; private qualityChangeCount; private previousVideoBitrate; private previousAudioBitrate; private resetIntervalId?; constructor(qualityChangeThreshold?: number); resetValues(): void; isQualityChangeEventEnabled(): boolean; increaseCounter(): void; shouldAllowVideoQualityChange(newBitrate: number | undefined): boolean; setVideoBitrate(newBitrate: number): void; shouldAllowAudioQualityChange(newBitrate: number | undefined): boolean; setAudioBitrate(newBitrate: number): void; startResetInterval(): void; stopResetInterval(): void; private resetCounter; } export interface Timespan { start: number; end: number; } declare class VideoCompletionTracker { private watched; private videoDuration; reset(): void; /** * sets video Duration * @param videoDuration in sec */ setVideoDuration(videoDuration: number): void; /** * Adds the watched timespan to the tracker * @param watched watched timespan you want to add to the tracker * @returns how much time(video parts which have not been seen yet) was added to the tracker */ addWatched(watched: Timespan): number; /** * returns the relative value of how much the user watch the content of the video */ getCompletionPercentage(): number; /** * Recursive Method to merge All Watched Blocks * @param watched * * @returns how much timespan was overlapping while merging the watchBlocks */ private mergeWatched; private getOverlappingType; private isMomentInTimespan; private mergeAndReplace; private getOverlappingTimespan; private getDuration; } export interface FeatureConfig { enabled: boolean | undefined; } declare abstract class Feature { private _config?; private _isEnabled; get config(): TConfig | undefined; get isEnabled(): boolean; abstract reset(): void; abstract enabled(): void; abstract disabled(): void; abstract configured(authenticated: boolean, config?: TConfig): void; disable(): void; configure(authenticated: boolean, configContainer?: TConfigContainer): TConfig | undefined; abstract extractConfig(configContainer: TConfigContainer): TConfig | undefined; } export interface DownloadSpeedInfo { /** * Number of completed segment downloads */ segmentsDownloadCount: number; /** * Total download size in bytes */ segmentsDownloadSize: number; /** * Total time spent downloading segments in milliseconds */ segmentsDownloadTime: number; /** * Average download speed in kbps */ avgDownloadSpeed: number; /** * Maximum download speed in kbps */ maxDownloadSpeed: number; /** * Minimum download speed in kbps */ minDownloadSpeed: number; /** * Average time to first byte in milliseconds */ avgTimeToFirstByte: number; } export interface DrmPerformanceInfo { readonly drmType: string; readonly drmLoadTime: number; } export interface ErrorDetailTrackingConfig extends FeatureConfig { numberOfHttpRequests: number | undefined; } export interface FeatureConfigContainer { errorDetails?: ErrorDetailTrackingConfig; } declare enum PlayerSize { Window = "WINDOW", Fullscreen = "FULLSCREEN" } export interface PlaybackInfo { isLive?: boolean; playerTech?: string; videoDuration?: number; streamFormat?: string; progUrl?: string; m3u8Url?: string; mpdUrl?: string; videoWindowWidth?: number; videoWindowHeight?: number; isMuted?: boolean; videoBitrate?: number; audioBitrate?: number; droppedFrames: number; isCasting?: boolean; castTech?: string; screenHeight?: number; screenWidth?: number; videoPlaybackHeight?: number; videoPlaybackWidth?: number; videoTitle?: string; size?: PlayerSize; audioCodec?: string; videoCodec?: string; audioLanguage?: string; subtitleEnabled?: boolean; subtitleLanguage?: string; } export interface SegmentInfo { name: string; timestamp: number; url: string; } declare class ErrorCode { readonly code: number; readonly message: string; static BITMOVIN_PLAYER_LICENSING_ERROR: ErrorCode; static SETUP_MISSING_LICENSE_WHITELIST: ErrorCode; static QUALITY_CHANGE_THRESHOLD_EXCEEDED: ErrorCode; static BUFFERING_TIMEOUT_REACHED: ErrorCode; static VIDEO_STARTUP_TIMEOUT_REACHED: ErrorCode; private constructor(); } declare class VideoStartFailedReason { readonly reason: string; readonly errorCode: ErrorCode | null; static PAGE_CLOSED: VideoStartFailedReason; static PLAYER_ERROR: VideoStartFailedReason; static TIMEOUT: VideoStartFailedReason; static UNKNOWN: VideoStartFailedReason; private constructor(); } export interface ErrorData { exceptionMessage?: string | undefined; exceptionStacktrace?: string[] | undefined; additionalData?: string | undefined; } export interface AnalyticsEventBase { currentTime?: number; } export interface ErrorEvent extends AnalyticsEventBase { code: number | undefined; message: string | undefined; legacyData?: any; data: ErrorData; } export interface VideoStartFailedEvent extends AnalyticsEventBase { reason: VideoStartFailedReason; } export interface Sample extends CustomDataValues { platform: string; sequenceNumber?: number; domain?: any; path?: string; language?: string; userAgent?: string; screenWidth?: number; screenHeight?: number; isLive?: boolean; isCasting?: boolean; castTech?: string; videoDuration?: number; size?: string; time?: number; videoWindowWidth?: number; videoWindowHeight?: number; droppedFrames?: number; played?: number; buffered?: number; paused?: number; ad?: number; seeked?: number; videoPlaybackWidth?: number; videoPlaybackHeight?: number; videoBitrate?: number; audioBitrate?: number; videoTimeStart?: number; videoTimeEnd?: number; videoStartupTime?: number; duration?: number; startupTime?: number; analyticsVersion?: any; playerStartupTime: number; pageLoadType: number; streamFormat?: string; isMuted?: boolean; progUrl?: string; m3u8Url?: string; mpdUrl?: string; playerTech?: string; version?: string; player?: any; state?: string; impressionId?: string; userId?: string; errorMessage?: any; errorCode?: any; errorData?: string; videoStartFailed?: boolean; videoStartFailedReason?: string; autoplay?: any; pageLoadTime: number; key?: string; playerKey?: any; cdnProvider?: any; videoId?: string; videoTitle?: string; customUserId?: string; drmType?: string; drmLoadTime?: number; subtitleEnabled?: boolean; subtitleLanguage?: string; downloadSpeedInfo?: DownloadSpeedInfo; errorSegments?: any[]; audioCodec?: string; videoCodec?: string; supportedVideoCodecs?: string[]; audioLanguage?: string; completed?: number; completedTotal?: number; } export interface StateMachineCallbacks { setup: (duration: number, state: string) => void; startup: (duration: number, state: string) => void; playing: (duration: number, state: string) => void; heartbeat: (duration: number, state: string, payload: Pick | Pick) => void; qualitychange: (duration: number, state: string) => void; qualitychange_pause: (duration: number, state: string) => void; qualitychange_rebuffering: (duration: number, state: string) => void; videoChange: (event: any) => void; audioChange: (event: any) => void; audiotrack_changing: () => void; pause: (duration: number, state: string) => void; paused_seeking: (duration: number, state: string) => void; end_play_seeking: (duration: number, state: string) => void; rebuffering: (duration: number, state: string) => void; error: (event: Readonly) => void; end: (duration: number, state: string) => void; unload: (duration: number, state: string) => void; ad: (duration: number, state: string) => void; mute: () => void; unMute: () => void; subtitle_changing: () => void; setVideoTimeEndFromEvent: (event: any) => void; setVideoTimeStartFromEvent: (event: any) => void; videoStartFailed: (event: Readonly, sendRequest: boolean) => void; source_changing: (duration: number, state: string, event: any) => void; startCasting: (duration: number, event: any) => void; casting: (duration: number, event: any) => void; manualSourceChange: (event: { config: AnalyticsConfig; }) => void; initialSourceChange: (event: { config: AnalyticsConfig; }) => void; muting_ready: (duration: number, state: string, event: any) => void; customdatachange: (duration?: number, state?: string, event?: { values: CustomDataValues; }) => void; release: () => void; playlistTransition: (event: Readonly) => void; } export interface Subscribable { subscribe(callback: EventHandler): () => void; unsubscribe(callback: EventHandler): any; } export type EventHandler = (args: TArgs) => void; export interface DeferredLicenseLoadingAdapterAPI { readonly supportsDeferredLicenseLoading?: boolean; readonly onLicenseKeyReceived: Subscribable<{ licenseKey: string; }>; readonly onLicenseCallFailed: Subscribable; } declare class AdCallbacks { onAdStarted: (event: any) => void; onAdFinished: (event: any) => void; onAdBreakStarted: (event: any) => void; onAdBreakFinished: (event: any) => void; onAdClicked: (event: any) => void; onAdError: (event: any) => void; onAdManifestLoaded: (event: any) => void; onAdQuartile: (event: any) => void; onAdSkipped: (event: any) => void; onPlay: (issuer?: string) => void; onPause: (issuer?: string) => void; onBeforeUnload: () => void; } export interface AdModuleAPI { readonly adCallbacks: AdCallbacks; isLinearAdActive: () => boolean; getContainer: () => HTMLElement; getAdModuleInfo: () => { name?: string; version?: string; }; currentTime: () => number; } export interface InternalAdapterAPI extends DeferredLicenseLoadingAdapterAPI { readonly downloadSpeedInfo: DownloadSpeedInfo; readonly segments: SegmentInfo[]; readonly stateMachineCallbacks: StateMachineCallbacks; readonly adModule?: AdModuleAPI; readonly videoCompletionTracker?: VideoCompletionTracker; readonly qualityChangeService: QualityChangeService; resetSourceRelatedState(): void; getPlayerVersion(): string; getPlayerName(): string; getPlayerTech(): string; getAutoPlay(): boolean; getDrmPerformanceInfo(): DrmPerformanceInfo | undefined; initialize(analytics: Analytics): Array>; getCurrentPlaybackInfo(): PlaybackInfo; sourceChange(config: AnalyticsConfig, timestamp: number): any; clearValues(): void; onError?(): void; setCustomData(values: CustomDataValues): void; } export interface OnErrorDetailEventObject { code: number | undefined; message: string | undefined; errorData?: ErrorData | undefined; } export interface ErrorDetailTrackingSettingsProvider { readonly licenseKey: string; readonly domain: string; readonly impressionId: string; readonly collectorConfig?: CollectorConfig; } export interface CastClientConfig { config: any; domain: any; path: string; language: string; userAgent: string; impressionId: string; userId: string; } export interface Backend { sendRequest(sample: Sample): any; sendUnloadRequest(sample: Sample): any; sendRequestSynchronous(sample: Sample): any; sendAdRequest(sample: any): any; } export interface AuthenticationCallback { authenticationCompleted(success: boolean, featureConfigs: FeatureConfigContainer | undefined): void; } export interface LicensingRequest { key?: string; domain: string; version: string; } declare class BackendFactory { createBackend(analyticsConfig: AnalyticsConfig, licensingRequest: LicensingRequest, adapter: DeferredLicenseLoadingAdapterAPI, authenticationCallback: AuthenticationCallback): Backend; private decorateWithDebuggingBackend; private decorateWithBackendFromConfigIfAvailable; private isEnabled; private createInnerBackend; } declare class Analytics { get version(): string; static version: string; static LICENSE_CALL_PENDING_TIMEOUT: number; static PAGE_LOAD_TYPE_TIMEOUT: number; static CAST_RECEIVER_CONFIG_MESSAGE: string; pageLoadTime: number; playerStartupTime: number; videoStartupTime: number; autoplay: boolean | undefined; sample: Sample; backend: Backend; errorDetailTrackingSettingsProvider: ErrorDetailTrackingSettingsProvider; get errorDetailSubscribable(): Subscribable; private config; private sessionHandler; private droppedSampleFrames; private startupTime; private adapter; private backendFactory; private featureManager; private onErrorDetailEventDispatcher; private adAnalytics; private authenticationCallback; constructor(config: AnalyticsConfig, adapter: InternalAdapterAPI, backendFactory?: BackendFactory); getPlayerInformationFromAdapter(): { player: string; version: string; playerTech: string; }; updateSamplesToCastClientConfig(samples: Sample[], castClientConfig: CastClientConfig): void; updateSampleToCastClientConfig(sample: Sample, castClientConfig: CastClientConfig): void; init(): void; release(): void; setConfigParameters(sample?: Sample, config?: AnalyticsConfig): void; generateNewImpressionId(): void; setUserId(): void; setupStateMachineCallbacks(): void; guardAgainstMissingVideoTitle: (oldConfig: AnalyticsConfig, newConfig: AnalyticsConfig | undefined) => void; guardAgainstMissingIsLive: (oldConfig: AnalyticsConfig, newConfig: AnalyticsConfig | undefined) => void; sourceChange: (config: AnalyticsConfig | undefined) => void; setCustomDataOnce: (values: CustomDataValues) => void; setCustomData: (values: CustomDataValues) => void; getCurrentImpressionId: () => string | undefined; getUserId: () => string; setDuration(duration: number): void; setState(state: string): void; setPlaybackVideoPropertiesFromEvent(event: any): void; setPlaybackAudioPropertiesFromEvent(event: any): void; setPlaybackInfoFromAdapter(): void; setupSample(): Sample; sendAnalyticsRequest(): void; sendAnalyticsRequestAndClearValues(): void; sendUnloadRequest(): void; sendAnalyticsRequestSynchronous(): void; clearValues(): void; getIsLiveFromConfigOrPlaybackInfo(config: AnalyticsConfig, isLiveFromPlayback?: boolean): boolean; getMergedCollectorConfig(newConfig: AnalyticsConfig | undefined, oldConfig?: AnalyticsConfig): CollectorConfig | undefined; getMergedAnalyticsConfig(newConfig: AnalyticsConfig | undefined, oldConfig?: AnalyticsConfig): AnalyticsConfig; /** * This method sanitizes the input and updates the analytics config. * @param values Object containing the customData and other fields */ private changeCustomData; private buildDefaultAnalyticsConfigValues; private checkForErrorsInConfig; private getDomainFromConfig; private createBackend; private getDomain; private setCompletionValues; private setVideoTimeStart; private setVideoTimeEnd; private sendQualityChange; } declare abstract class Adapter { protected analytics: Analytics; protected internalAdapter: InternalAdapterAPI; getCurrentImpressionId(): string | undefined; getUserId(): string | undefined; setCustomData(values: CustomDataValues): void; setCustomDataOnce(values: CustomDataValues): void; sourceChange(config: AnalyticsConfig): void; protected hasPlayerAlreadyBeenAugmented(player: any): boolean; protected markPlayerInstanceAsAugmented(player: any): void; private guardAgainstNotInitializedAnalytics; } export declare class AmazonIVSAdapter extends Adapter implements AdapterAPI { constructor(config: AnalyticsConfig, player: any, opts?: AnalyticsStateMachineOptions); private wrapPlayerLoad; } export declare class Bitmovin8Adapter extends Adapter implements AdapterAPI { constructor(player: any, opts?: AnalyticsStateMachineOptions); private wrapPlayerLoad; } export declare class CAFv3Adapter extends Adapter implements AdapterAPI { constructor(config: AnalyticsConfig, player: any, opts?: AnalyticsStateMachineOptions); } export declare class DashjsAdapter extends Adapter implements AdapterAPI { constructor(config: AnalyticsConfig, player: any, opts?: AnalyticsStateMachineOptions); } export declare class HTMLVideoElementAdapter extends Adapter implements AdapterAPI { constructor(config: AnalyticsConfig, player: HTMLVideoElement, opts?: AnalyticsStateMachineOptions); } export declare class HlsAdapter extends Adapter implements AdapterAPI { constructor(config: AnalyticsConfig, player: any, opts?: AnalyticsStateMachineOptions); } export declare class ShakaAdapter extends Adapter implements AdapterAPI { constructor(config: AnalyticsConfig, player: any, opts?: AnalyticsStateMachineOptions); private wrapPlayerLoad; } export declare class VideojsAdapter extends Adapter implements AdapterAPI { constructor(config: AnalyticsConfig, player: any, opts?: AnalyticsStateMachineOptions); } declare enum CdnProvider { CLOUDFLARE = "cloudflare", AKAMAI = "akamai", FASTLY = "fastly", MAXCDN = "maxcdn", CLOUDFRONT = "cloudfront", CHINACACHE = "chinacache", BITGRAVITY = "bitgravity" } declare enum Player { BITMOVIN = "bitmovin", JW = "jw", RADIANT = "radiant", VIDEOJS = "videojs", HLSJS = "hlsjs", SHAKA = "shaka", DASHJS = "dashjs", HTML5 = "html5", CHROMECAST_SHAKA = "chromecast-shaka", AMAZON_IVS = "amazonivs" } /** * @see https://github.com/bitmovin-engineering/bitdash/blob/ccd3227dac82d1416a471711b40ee0f65d7f9ddb/src/ModuleDefinition.ts#L17 */ export declare const PlayerModule: { readonly name: "analytics"; readonly module: { readonly Analytics: typeof Bitmovin8Adapter; }; readonly hooks: { readonly setup: (module: any, player: any) => Promise; }; }; export declare const adapters: { AmazonIVSAdapter: typeof AmazonIVSAdapter; Bitmovin8Adapter: typeof Bitmovin8Adapter; CAFv3Adapter: typeof CAFv3Adapter; DashjsAdapter: typeof DashjsAdapter; HTMLVideoElementAdapter: typeof HTMLVideoElementAdapter; HlsAdapter: typeof HlsAdapter; ShakaAdapter: typeof ShakaAdapter; VideojsAdapter: typeof VideojsAdapter; }; declare const _default: { PlayerModule: { readonly name: "analytics"; readonly module: { readonly Analytics: typeof Bitmovin8Adapter; }; readonly hooks: { readonly setup: (module: any, player: any) => Promise; }; }; }; export { CdnProvider as CdnProviders, Player as Players, VERSION as version, _default as default, }; export {};