Last active
June 20, 2022 14:43
-
-
Save micHar/46ccc066e5fb20bb03cb353827573203 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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