setPlaybackRange

Sets a new active playback range on this SyncMediaPlayer, and by default, immediately seeks to range.start.

When the SyncMediaPlayer reaches range.end during playback, it will automatically pause and the OnSyncMediaRangeEventListener.onPlaybackRangeEndReached will be called. By default, the playback range is removed when the SyncMediaPlayer reaches range.end, but you can change this behaviour by setting removeRangeOnEndReached to false in the options object.

Playback range removal

An active playback range can be removed by calling removePlaybackRange.

The playback range may also be removed due to seeking, either by calling any of the seek methods in SyncMediaPlayer, or due to a synchronization operation with an attached ReaderView. You can control how seeking affects the active playback range by setting a seekBehavior in the options object.

When a playback range is removed, OnSyncMediaRangeEventListener.onPlaybackRangeRemoved will be called. The property SyncMediaRangeEngineEventData.reason contains details to why the playback range was removed.

The operation will fail and return an error if:

  • the end position is before start position.

  • the SyncMediaPlayer has been destroyed.

Return

Either ColibrioResult.Success with the resulting playback range when successful, or ColibrioResult.Error containing the error if the operation fails.