Skip to content

Commit

Permalink
Add Example Usage of MediaPlayer Utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
teogor committed Oct 1, 2023
1 parent c423548 commit 609730c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/src/main/kotlin/dev/teogor/ceres/feature/home/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
Expand All @@ -32,6 +33,8 @@ import androidx.compose.ui.unit.sp
import androidx.hilt.navigation.compose.hiltViewModel
import com.skydoves.landscapist.ImageOptions
import com.skydoves.landscapist.glide.GlideImage
import dev.teogor.ceres.R
import dev.teogor.ceres.core.foundation.extensions.createMediaPlayer
import dev.teogor.ceres.framework.core.app.BaseActions
import dev.teogor.ceres.framework.core.app.setScreenInfo
import dev.teogor.ceres.framework.core.compositions.LocalNetworkConnectivity
Expand Down Expand Up @@ -107,6 +110,16 @@ internal fun HomeRoute(

val networkConnectivity = LocalNetworkConnectivity.current

val switchOff = createMediaPlayer(R.raw.button_switch_off)
LaunchedEffect(switchOff) {
switchOff.start()
}

val switchOn = createMediaPlayer(R.raw.button_switch_on)
LaunchedEffect(switchOn) {
switchOn.start()
}

if (canRequestAds) {
HomeScreen(
homeVM,
Expand Down
Binary file added app/src/main/res/raw/button_switch_off.mp3
Binary file not shown.
Binary file added app/src/main/res/raw/button_switch_on.mp3
Binary file not shown.

0 comments on commit 609730c

Please sign in to comment.