but more specifically not using interoperability with Swift/Objective-C using
expect/actual
Rather has anyone built an interface
PlatformMediaPlayer
which then has an implementation on each platform and is injected into the common code via DI (specifically Koin). ?
markturnip
05/23/2024, 8:16 AM
Copy code
enum class PlaybackState {
PLAYING, PAUSED, STOPPED
}
interface PlatformMediaPlayer {
fun play()
fun pause()
val isPlaying: Boolean
val playbackState: StateFlow<PlaybackState>
}
Copy code
fun initKoin(nativeModule: PlatformMediaPlayer) {
// Start Koin
val koinApp = startKoin {
modules(appModule, module {
single { nativeModule }
})
}.koin
}