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

    A SyncMediaTimeline is created by calling any of the createSyncMediaTimeline() methods on a ReaderPublication. Each publication format supports different sync media formats. EPUB supports Media Overlays as well as content block based TTS, whereas PDF only supports content block based TTS. For example: EpubReaderPublication.createMediaOverlaySyncMediaTimeline() or EpubReaderPublication.createTtsSyncMediaTimeline()

    The SyncMediaTimeline contains a list of segments that should be played in order. Each segment contains references to media objects that should be played in parallel.

    The SyncMediaTimeline also contains methods for mapping between SyncMediaTimelinePositions and ContentLocations. This feature allows the reading system to synchronize SyncMedia playback with visible publication content such as automatic page turning and highlighting of narrated content.

    interface ISyncMediaTimeline {
        createDefaultMediaObjectRenderers(): ISyncMediaObjectRenderer[];
        fetchContentLocation(
            timelinePosition: ISyncMediaTimelinePosition,
        ): Promise<IContentLocation>;
        fetchTimelinePosition(
            locatorOrLocation:
                | ILocator
                | ILocatorData
                | IContentLocation
                | IReaderPublicationNavigationItemData
                | IReaderPublicationNavigationItem
                | IUnresolvedContentLocation,
        ): Promise<ISyncMediaTimelinePosition>;
        fetchTimelineRange(
            locatorOrLocation:
                | ILocator
                | ILocatorData
                | IContentLocation
                | IUnresolvedContentLocation,
        ): Promise<ISyncMediaTimelineRange>;
        getApproximateDurationMs(): number;
        getApproximateOffsetMs(position: ISyncMediaTimelinePosition): number;
        getMediaObjectRefTypes(): SyncMediaObjectRefType[];
        getMediaObjects(): ISyncMediaObject[];
        getReaderDocuments(): IReaderDocument[];
        getReaderPublication(): IReaderPublication;
        getResourceProvider(): IResourceProvider;
        getSegments(): readonly ISyncMediaSegment[];
        getSyncMediaFormat(): SyncMediaFormat;
        getTimelinePositionFromApproximateOffsetMs(
            approximateOffsetMs: number,
        ): ISyncMediaTimelinePosition;
        toJSON(): ISyncMediaTimelineData;
    }

    Methods

    • Gets the total duration of the timeline in milliseconds.

      It is possible that the duration is updated during runtime as media is loaded and more information is available. If this happens, a syncMediaSegmentDurationChanged engine event will fire after the duration has been updated.

      Returns number

    • Get the timeline position that most closely matches an offset into the timeline. If the offsetMs is negative, the position at the start of the timeline will be returned and if the offset is larger than the duration of the timeline, the position at the end of the timeline will be returned.

      Parameters

      • approximateOffsetMs: number

        Milliseconds into the timeline.

      Returns ISyncMediaTimelinePosition