Colibrio Reader Framework API - Cloud license
    Preparing search index...

    NOTE: This feature is currently in BETA. Expect breaking changes to the APIs related with WpPublication/Audiobooks until the final 3.0.0 release.

    Format specific API for Web Publication Audiobook Publications.

    In an IWpAudiobookReaderPublication instance, the ReaderDocuments returned by getSpine() are describing audio resources and can therefore not be rendered by a ReaderView.

    Use createSyncMediaTimeline() to create a ISyncMediaTimeline instance which then can be loaded into a SyncMediaPlayer to play the Audiobook. To create a SyncMediaPlayer, see ReadingSystemEngine.createSyncMediaPlayer()

    const wpPublication = await WpPublication.createFromBlob(lpfFile);
    const engine = new ReadingSystemEngine({licenseApiKey: 'my-api-key'});
    engine.addFormatAdapter(new WpAudiobookFormatAdapter());
    const readerPublication = await engine.loadPublication(wpPublication) as IWpAudiobookReaderPublication;
    const syncMediaTimeline = await readerPublication.createSyncMediaTimeline(readerPublication.getSpine());
    const syncMediaPlayer = engine.createSyncMediaPlayer(syncMediaTimeline);
    interface IWpAudiobookReaderPublication {
        createSyncMediaTimeline(
            readerDocuments: IReaderDocument[],
            options?: IWpAudiobookSyncMediaTimelineOptions,
            progressCallback?: (progress: number) => void,
        ): Promise<ISyncMediaTimeline>;
        destroy(): void;
        fetchContentLocation(
            locator:
                | ILocator
                | ILocatorData
                | IReaderPublicationNavigationItemData
                | IReaderPublicationNavigationItem,
        ): Promise<IContentLocation>;
        fetchPreferredPageAspectRatio(): Promise<number>;
        fetchPublicationNavigation(): Promise<IReaderPublicationNavigation>;
        fetchUnresolvedContentLocation(
            locator:
                | ILocator
                | ILocatorData
                | IReaderPublicationNavigationItemData
                | IReaderPublicationNavigationItem,
        ): Promise<IUnresolvedContentLocation>;
        getAvailableContentPositionTimelineUnits(): ContentPositionTimelineUnit[];
        getAvailableSyncMediaFormats(): SyncMediaFormat[];
        getDefaultLocatorUrl(): string;
        getLocatorFactory(): ILocatorFactory;
        getOptions(): DeepRequired<IWpAudiobookReaderPublicationOptions>;
        getReaderPublicationStorage(): IReaderPublicationStorage;
        getReadingSystemEngine(): IReadingSystemEngine;
        getSourcePublication(): IWpPublication;
        getSpine(): IWpAudiobookReaderDocument[];
        isDestroyed(): boolean;
        isLocatorSourceUrlInPublication(locator: ILocator | ILocatorData): boolean;
        setOptions(options: IWpAudiobookReaderPublicationOptions): void;
        toJSON(): IReaderPublicationData;
    }

    Hierarchy (View Summary)

    Methods

    • Creates a SyncMediaTimeline that can be used with a ISyncMediaPlayer to play the contents of this audiobook.

      The returned promise is rejected if the resulting timeline is empty.

      Parameters

      • readerDocuments: IReaderDocument[]

        The reader documents that should be part of the timeline.

      • Optionaloptions: IWpAudiobookSyncMediaTimelineOptions

        Options for the IEpubMediaOverlaySyncMediaTimeline.

      • OptionalprogressCallback: (progress: number) => void

        A function called several times indicating the create progress as a value between 0 and 1. You can also listen on the event 'syncMediaTimelineCreateProgress' to get this information.

      Returns Promise<ISyncMediaTimeline>

    • Destroy this instance, allowing used resources to be garbage collected. This method has the same effect as calling readingSystemEngine.unloadPublication(),

      Returns void

    • If the source URL of the locator, (that is URL without the hash) matches the any source URL in the Publication.

      If this method returns true, the locator MAY target content in the publication, depending on selectors inside the Locator. If this method return false, the locator DOES NOT target any content in the publication.

      Parameters

      Returns boolean

    • Sets new IReaderPublicationOptions for this instance. Existing properties are preserved if they aren't defined in the passed options object. Properties explicitly set to undefined will be restored to their default values.

      Changes affecting the appearance or behavior of the ReaderPublication when used with a ReaderView will not take effect until ReaderView.refresh(true) is called.

      Returns void