@readium/navigator
Version:
Next generation SDK for publications in Web Apps
32 lines (31 loc) • 1.4 kB
TypeScript
import { Publication } from "@readium/shared";
import { WebAudioEngine } from "./engine/WebAudioEngine.ts";
import type { IAudioContentProtectionConfig } from "./AudioNavigator.ts";
export declare class AudioPoolManager {
private readonly pool;
private _audioEngine;
private readonly _publication;
private readonly _supportedAudioTypes;
constructor(audioEngine: WebAudioEngine, publication: Publication, contentProtection?: IAudioContentProtectionConfig);
private detectSupportedAudioTypes;
private pickPlayableHref;
get audioEngine(): WebAudioEngine;
/**
* Ensures an audio element exists in the pool for the given href.
* If one already exists, it is left untouched (preserving its buffered data).
*/
private ensure;
/**
* Updates the pool around the given index: ensures elements exist within
* the LOWER_BOUNDARY and disposes those beyond the UPPER_BOUNDARY.
* The current track is excluded — the primary engine element represents it.
*/
private update;
/**
* Sets the current audio for playback at the given track index by changing
* the src on the persistent primary element. This preserves the RemotePlayback
* session and any Web Audio graph connections across track changes.
*/
setCurrentAudio(currentIndex: number, _direction: 'forward' | 'backward'): void;
destroy(): void;
}