Adds an EngineEvent listener to this instance.
Adds support for a specific publication format. Format adapters implemented by Colibrio can be found in colibrio.readingsystem.format
Creates a new ReaderView that can render content from publications loaded by this engine.
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.
Destroys this instance, including any ReaderView, SyncMediaPlayer, ReaderPublication instances created using this ReadingSystemEngine.
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.
Destroys a SyncMediaPlayer created using this ReadingSystemEngine. Throws an error if the SyncMediaPlayer was not created using this ReadingSystemEngine.
Get all EngineEvent listeners for the specified type that has been added to this instance.
Get the event bus used for emitting events.
To listen to events emitted by this ReadingSystemEngine, use addEngineEventListener()
.
Get the semver version of the Colibrio Reader Framework. For example: "2.0.0-rc.1"
Get the options currently used by this ReadingSystemEngine.
Gets the API that can be used for searching in ReaderDocuments.
Get all reader publications that have been loaded by this ReadingSystemEngine.
Get a ReaderView that was created using this ReadingSystemEngine by name.
The ReaderView instance if one with that name exists.
Get all ReaderView instances that was created using this ReadingSystemEngine.
Get a SyncMediaPlayer that was created using this ReadingSystemEngine by name.
The SyncMediaPlayer instance if one with that name exists.
Get all synchronized media players that have been created using this ReadingSystemEngine.
If destroy() has been called on this instance.
Load a publication into this ReadingSystemEngine.
A Promise resolved with a ReaderPublication instance if the publication is successfully loaded. Rejected if no format adapter is able to handle the publication format. Rejected if the publication is invalid or contained errors that were not possible to recover from.
Removes an EngineEvent listener that was previously added to this instance.
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.
Unloads a publication previously loaded with loadPublication().
Get the semver version of the Colibrio Reader Framework. For example: "2.0.0-rc.1"
Generated using TypeDoc
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. CallloadPublication()
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.
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.