refactor: enhance playback behavior with screen reader support and delayed actions
This commit is contained in:
1 parent
38c5d2678a
commit
df38936893
2 files changed
+69
-17
No files matched your search
+4
-1
@@ -55,8 +55,11 @@ internal class IosAudioPlayer : AudioPlayer {
|
||||
@OptIn(ExperimentalForeignApi::class)
|
||||
override fun seekTo(position: Duration) {
|
||||
val seconds = position.inWholeMilliseconds / 1000.0
|
||||
// Resume after seeking (e.g. back from the end of the record), unless playback was paused
|
||||
// on purpose: the caller may be holding it, for instance while a screen reader speaks.
|
||||
val resume = _playbackState.value != PlaybackState.PAUSED
|
||||
player?.seekToTime(CMTimeMakeWithSeconds(seconds, preferredTimescale = 1000)) {
|
||||
play()
|
||||
if (resume) play()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user