Options
All
  • Public
  • Public/Protected
  • All
Menu

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()

example
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);

Hierarchy

Index

Methods

createSyncMediaTimeline

  • 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.

    • Optional options: IWpAudiobookSyncMediaTimelineOptions

      Options for the IEpubMediaOverlaySyncMediaTimeline.

    • Optional progressCallback: (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.

        • (progress: number): void
        • Parameters

          • progress: number

          Returns void

    Returns Promise<ISyncMediaTimeline>

destroy

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

    Returns void

fetchContentLocation

  • Fetch the resolved IContentLocation from a locator, ILocatorData, URL, URI, URN, IRI.

    In contrast to UnresolvedContentLocation, a ContentLocation knows its position within the publication content and can thereby be used to compare and sort ContentLocation instances synchronously.

    See IContentLocation for more information

    Parameters

    Returns Promise<IContentLocation>

fetchPreferredPageAspectRatio

  • fetchPreferredPageAspectRatio(): Promise<number>

fetchPublicationNavigation

fetchUnresolvedContentLocation

getAvailableContentPositionTimelineUnits

getAvailableSyncMediaFormats

getDefaultLocatorUrl

  • getDefaultLocatorUrl(): string

getLocatorFactory

getOptions

getReaderPublicationStorage

  • Get the IReaderPublicationStorage instance for this publication. Use the returned instance to manage the publication's storage, such as 'localStorage' for EPUB. This allows applications to save and restore the state of the IReaderPublicationStorage across reading-sessions and devices.

    Returns IReaderPublicationStorage

getReadingSystemEngine

getSourcePublication

getSpine

  • Get an ordered list of IReaderDocument instances that are part of this publication.

    Note that the ReaderDocuments in an IWpAudiobookReaderPublication are purely audio and can not be rendered by a ReaderView.

    Returns IWpAudiobookReaderDocument[]

isDestroyed

  • isDestroyed(): boolean

isLocatorSourceUrlInPublication

  • 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

setOptions

  • 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.

    Parameters

    Returns void

toJSON

Generated using TypeDoc