-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from techbeloved/78-media-playback-multiplatform
78-media-playback-multiplatform Implement bottom ui controls and import tunes from the assets folder into the database
- Loading branch information
Showing
36 changed files
with
646 additions
and
58 deletions.
There are no files selected for viewing
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
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
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
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
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
37 changes: 37 additions & 0 deletions
37
modules/media/src/androidMain/kotlin/com/techbeloved/media/DummyPlaybackController.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.techbeloved.media | ||
|
||
import kotlinx.collections.immutable.ImmutableList | ||
|
||
class DummyPlaybackController(private val playbackState: PlaybackState) : PlaybackController { | ||
private val queue = mutableListOf<AudioItem>() | ||
override fun play() { | ||
playbackState.isPlaying = true | ||
} | ||
|
||
override fun pause() { | ||
playbackState.isPlaying = false | ||
} | ||
|
||
override fun seekTo(position: Long) { | ||
playbackState.position = position | ||
} | ||
|
||
override fun seekToNext() { | ||
} | ||
|
||
override fun seekToPrevious() { | ||
} | ||
|
||
override fun setItems(items: ImmutableList<AudioItem>) { | ||
queue.clear() | ||
queue.addAll(items) | ||
} | ||
|
||
override fun prepare() { | ||
playbackState.playerState = PlayerState.Ready | ||
} | ||
|
||
override fun playWhenReady() { | ||
if (playbackState.playerState == PlayerState.Ready) play() | ||
} | ||
} |
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
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
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
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
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
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
14 changes: 13 additions & 1 deletion
14
modules/media/src/iosMain/kotlin/com/techbeloved/media/PlaybackState.ios.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,23 @@ | ||
package com.techbeloved.media | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.DisposableEffect | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.rememberCoroutineScope | ||
import androidx.compose.runtime.setValue | ||
|
||
@Composable | ||
actual fun rememberPlaybackController(playbackState: PlaybackState): PlaybackController? { | ||
val coroutineScope = rememberCoroutineScope() | ||
return remember { IosPlaybackController(playbackState, coroutineScope) } | ||
var playbackController: PlaybackController? by remember { mutableStateOf(null) } | ||
DisposableEffect(playbackState) { | ||
val iosPlaybackController = IosPlaybackController(playbackState, coroutineScope) | ||
playbackController = iosPlaybackController | ||
onDispose { | ||
iosPlaybackController.onDispose() | ||
} | ||
} | ||
return playbackController | ||
} |
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
3 changes: 3 additions & 0 deletions
3
...p/kotlin/com/techbeloved/hymnbook/shared/media/SupportedMediaFormats.androidAndDesktop.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.techbeloved.hymnbook.shared.media | ||
|
||
internal actual val platformSupportedAudioFormats: List<String> = listOf("ogg", "opus") |
7 changes: 7 additions & 0 deletions
7
...roidAndDesktop/kotlin/com/techbeloved/hymnbook/shared/ui/AppScaffold.androidAndDesktop.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.techbeloved.hymnbook.shared.ui | ||
|
||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.automirrored.filled.ArrowBack | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
|
||
internal actual val navigationArrowBack: ImageVector = Icons.AutoMirrored.Filled.ArrowBack |
Oops, something went wrong.