create Tts Sync Media Timeline
Creates a new TTS SyncMediaTimeline from the specified list of ReaderDocuments. The resulting SyncMediaTimeline can be played using a SyncMediaPlayer.
When creating a TTS SyncMediaTimeline, you must specify:
A TTS Synthesizer used for speaking the text contents.
A ReaderViewAnnotationLayer used for highlighting the currently spoken text.
TtsSynthesizer
The TtsSynthesizer is responsible for synthesizing text fragments into audio and play it. This framework provides ColibrioTtsSynthesizer which uses android.speech.tts.TextToSpeech.
Highlighting
When playing the timeline, the passed ReaderViewAnnotationLayer will be used to create ReaderViewAnnotation instances for highlighting the current spoken text.
Use TtsSyncMediaTimelineConfiguration.rendererOptions to configure how the highlights should be styled. If no options are specified, the options set using ReaderViewAnnotationLayer.defaultAnnotationOptions will be used.
WARNING: If you don't specify any range styles using TtsSyncMediaTimelineConfiguration.rendererOptions or ReaderViewAnnotationLayer.defaultAnnotationOptions, highlights will be transparent!
Checking if publication supports TTS
You can check if this publication supports TTS by checking if availableSyncMediaFormats contains SyncMediaFormat.CONTENT_BLOCK_TTS.
Failed calls
If the call fails, ownership of TtsSyncMediaTimelineConfiguration.ttsSynthesizer returns to you; see that property for what you must then do with it.
Parameters
The reader documents that should be part of the timeline.
The TTS SyncMediaTimeline configuration.
Called when the SyncMediaTimeline has been created successfully.
Called if there was an error creating the timeline.
A function called several times indicating the create progress as a value between 0 and 1.
Creates a new TTS SyncMediaTimeline from the specified list of ReaderDocuments. The resulting SyncMediaTimeline can be played using a SyncMediaPlayer.
When creating a TTS SyncMediaTimeline, you must specify:
A TTS Synthesizer used for speaking the text contents.
A ReaderViewAnnotationLayer used for highlighting the currently spoken text.
TtsSynthesizer
The TtsSynthesizer is responsible for synthesizing text fragments into audio and play it. This framework provides ColibrioTtsSynthesizer which uses android.speech.tts.TextToSpeech.
Highlighting
When playing the timeline, the passed ReaderViewAnnotationLayer will be used to create ReaderViewAnnotation instances for highlighting the current spoken text.
Use TtsSyncMediaTimelineConfiguration.rendererOptions to configure how the highlights should be styled. If no options are specified, the options set using ReaderViewAnnotationLayer.defaultAnnotationOptions will be used.
WARNING: If you don't specify any range styles using TtsSyncMediaTimelineConfiguration.rendererOptions or ReaderViewAnnotationLayer.defaultAnnotationOptions, highlights will be transparent!
Checking if publication supports TTS
You can check if this publication supports TTS by checking if availableSyncMediaFormats contains SyncMediaFormat.CONTENT_BLOCK_TTS.
Threading
Call this from the main dispatcher. Called from another dispatcher, the cleanup that runs when the call fails or is cancelled may not reach the reading system, leaving the timeline behind.
Failed and cancelled calls
Ownership of TtsSyncMediaTimelineConfiguration.ttsSynthesizer returns to you; see that property for what you must then do with it.
Cancelling does not abort a timeline the reading system has already started building. Such a timeline may still be created, and you never receive its handle; it is released when the publication is unloaded.
Return
Either ColibrioResult.Success with the created SyncMediaTimeline if the operation is successful, or ColibrioResult.Error if an error occurred while creating the timeline.
Parameters
The reader documents that should be part of the timeline.
The TTS SyncMediaTimeline configuration.
A function called several times indicating the create progress as a value between 0 and 1.