Audio Timeline
An AudioTimeline represents the playback order of the audio publication content.
The timeline contains a list of segments defining the playback order of mediaObjects.
An AudioTimeline is played using a ColibrioAudioPlayer.
AudioTimeline instances are created from AudioPublication instances. For example: WpAudioPublication.createAudioTimeline
Segment lengths
A segment whose audio length the publication does not state has SyncMediaSegmentData.durationType until the length is measured. A measured segment has SyncMediaSegmentDurationType.FIXED. FIXED means that the length is known. It does not mean that the length is exact. For example, the length of an MP3 file with a variable bitrate can be an estimate. A segment has audio when its SyncMediaSegmentData.refs contain a SyncMediaAudioRef.
The framework measures lengths at these points:
WpAudioPublication.createAudioTimeline measures each audio file whose duration the manifest leaves out or states in an invalid format.
AudioReadingSystemEngine.loadEpubMediaOverlayAudioPublication does not measure audio lengths. A Media Overlay clip without
clipEndstarts asUNKNOWN, unless an earlier player already measured it in EpubMediaOverlayLoadConfig.timeline.AudioReadingSystemEngine.createAudioPlayer measures each segment that is still
UNKNOWNbefore it returns the player. After it has returned, a segment with audio that is stillUNKNOWNcould not be measured. A segment without audio, such as an EPUB Media Overlayparwith only text, staysUNKNOWNwith a length of 0.ColibrioAudioPlayer.reload measures the segments that are still
UNKNOWNagain.During playback, the player can measure an
UNKNOWNsegment when it loads the segment's audio file. It can also correct a known length that does not match the audio file.
While the length of any segment with audio is unknown, approximateDurationMs counts only the known lengths. OnMediaPlayerEventListener.onSegmentDurationChanged reports each length that ColibrioAudioPlayer.reload or playback measures or corrects. The lengths that AudioReadingSystemEngine.createAudioPlayer measures reach no listener, because the call measures them before you can add a listener. OnMediaPlayerEventListener.onError describes the same limit for errors. Read these lengths from segments and approximateDurationMs after the call has returned.
Properties
The approximate total duration of the timeline in milliseconds. It is the sum of the known segment lengths.
The media objects, such as audio and video resources, used by this timeline. Media objects are referenced by SyncMediaSegments
All segments in the timeline defining the playback order of mediaObjects.
Functions
Get the approximate offset into the timeline in milliseconds from a timeline position object.
Returns the navigation item references related to the specified timeline position.
Find the SyncMediaTimelinePositionData that most closely corresponds to a PublicationNavigationItem.
Get the timeline position that most closely matches an offset into the timeline. If the offset is negative, the position at the start of the timeline will be returned. If the offset is larger than the duration of the timeline, the position at the end of the timeline will be returned.