Skip to content

Instantly share code, notes, and snippets.

@micHar
Last active June 20, 2022 14:43
Show Gist options
  • Save micHar/46ccc066e5fb20bb03cb353827573203 to your computer and use it in GitHub Desktop.
Save micHar/46ccc066e5fb20bb03cb353827573203 to your computer and use it in GitHub Desktop.
interface SoundPlayer {
suspend fun playSound()
}
class MediaPlayer(
private val scope: CoroutineScope,
private val soundPlayer: SoundPlayer
) {
var playbackCounter = 0
fun play() {
scope.launch {
soundPlayer.playSound()
playbackCounter++
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment