Options
All
  • Public
  • Public/Protected
  • All
Menu

ReadingSystemEngine is the entry point to the Colibrio Reading System API. It is used for loading publications, creating ReaderViews and SyncMediaPlayers.

Loading publications

The ReadingSystemEngine does not know about any publication formats initially. You need to use addFormatAdapter() to add support for a specific publication format. Call loadPublication() to load a source publication into the ReadingSystemEngine. The returned ReaderPublication can be used with ReaderViews to render content.

Engine Events

The reading system event bus lets you listen and react to events that occur in the reading system. This can for example be, the user clicking a link or an image, or a ReaderView navigating to the next page.

You can addEngineEventListener() on for example ReadingSystemEngines and ReaderViews. The reading system uses an event model that is similar to native browser events. Thus, you will find that most properties and methods from the native browser events also exist in the IEngineEvent interface. Just like browser events, EngineEvents bubbles from the deepest event target and upwards.

example

let engine = new ReadingSystemEngine({ licenseApiKey: 'my-license-api-key'}); engine.addFormatAdapter(new EpubFormatAdapter()); let readerPublication = await engine.loadPublication(epubOcf.getDefaultPublication()); let readerView = engine.createReaderView(); readerView.setReaderDocuments(readerPublication.getSpine()); // See ReaderView docs for how to continue setting it up.

Hierarchy

  • ReadingSystemEngine

Implements

Index

Constructors

constructor

Methods

addEngineEventListener

addFormatAdapter

createReaderView

createSyncMediaPlayer

  • Creates a new SyncMediaPlayer. Use for playing synchronized media such as EPUB Media Overlays or TTS (Text-To-Speech). You can create SyncMediaTimeline instances from publications using the format specific ReaderPublication instances. For example EpubReaderPublication.createMediaOverlaySyncMediaTimeline() or IPdfReaderPublication.createTtsSyncMediaTimeline().

    A SyncMediaPlayer can play media with or without being attached to a ReaderView. If attached to a ReaderView using readerView.setSyncMediaPlayer() the ReaderView and SyncMediaPlayer can synchronize their positions. This enables features such as text highlighting and automatic page turning.

    Parameters

    Returns ISyncMediaPlayer

destroy

  • destroy(): void
  • Destroys this instance, including any ReaderView, SyncMediaPlayer, ReaderPublication instances created using this ReadingSystemEngine.

    Returns void

destroyReaderView

  • Destroys a ReaderView and its annotation layers, releasing any underlying resources used by the ReaderView and the activeRenderer. This will also remove all EngineEvent listeners that have been added to the ReaderView.

    Parameters

    Returns void

destroySyncMediaPlayer

getEngineEventListeners

getEventBus

getFrameworkVersion

  • getFrameworkVersion(): string

getOptions

getReaderDocumentSearch

getReaderPublications

getReaderViewByName

getReaderViews

getSyncMediaPlayerByName

getSyncMediaPlayers

isDestroyed

  • isDestroyed(): boolean

loadPublication

removeEngineEventListener

setOptions

  • Set new ReadingSystemEngineOptions. Existing properties are preserved if they are not defined in the passed options object. Properties explicitly set to undefined will be restored to their default values.

    Parameters

    Returns void

unloadPublication

Static getFrameworkVersion

  • getFrameworkVersion(): string
  • Get the semver version of the Colibrio Reader Framework. For example: "2.0.0-rc.1"

    Returns string

Generated using TypeDoc