Skip to content

Commit

Permalink
Fix coroutines deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenzeck committed Sep 21, 2024
1 parent 4d07b26 commit 47c26aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ public class ExoPlayerEngine private constructor(

private suspend fun prepareExoPlayer(player: ExoPlayer) {
lateinit var listener: Player.Listener
suspendCancellableCoroutine { continuation ->
suspendCancellableCoroutine<Unit> { continuation ->
listener = object : Player.Listener {
override fun onPlaybackStateChanged(playbackState: Int) {
when (playbackState) {
Player.STATE_READY -> continuation.resume(Unit) {}
Player.STATE_READY -> continuation.resume(Unit) { _, _, _ -> }
Player.STATE_IDLE -> if (player.playerError != null) {
continuation.resume(Unit) {}
continuation.resume(Unit) { _, _, _ -> }
}
else -> {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ internal class TtsEngineFacade<S : TtsEngine.Settings, P : TtsEngine.Preferences
}

override fun onDone(requestId: TtsEngine.RequestId) {
popTask(requestId)?.continuation?.resume(null) {}
popTask(requestId)?.continuation?.resume(null) { _, _, _ -> }
}

override fun onError(requestId: TtsEngine.RequestId, error: E) {
popTask(requestId)?.continuation?.resume(error) {}
popTask(requestId)?.continuation?.resume(error) { _, _, _ -> }
}
}
}

0 comments on commit 47c26aa

Please sign in to comment.