adapt landscape direction
This commit is contained in:
+5
@@ -223,6 +223,7 @@ actual class PlayerController(context: Context) {
|
||||
}
|
||||
|
||||
actual fun play() {
|
||||
if (player.mediaItemCount == 0) return
|
||||
player.play()
|
||||
}
|
||||
|
||||
@@ -231,6 +232,10 @@ actual class PlayerController(context: Context) {
|
||||
}
|
||||
|
||||
actual fun toggle() {
|
||||
if (player.mediaItemCount == 0) {
|
||||
if (player.isPlaying) pause()
|
||||
return
|
||||
}
|
||||
if (player.isPlaying) pause() else play()
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -646,7 +646,8 @@ actual class PlayerController {
|
||||
actual fun play() {
|
||||
ensureAudioReady()
|
||||
val current = _state.value.current
|
||||
if (loadedUri.isNullOrBlank() && current != null) {
|
||||
if (current == null) return
|
||||
if (loadedUri.isNullOrBlank()) {
|
||||
playWhenReady = false
|
||||
AppLog.e(TAG, "play() abort reason=noLoadedUri id=${current.musicId}")
|
||||
_state.update { it.copy(isPlaying = false, error = "No playable URI") }
|
||||
@@ -674,6 +675,10 @@ actual class PlayerController {
|
||||
}
|
||||
|
||||
actual fun toggle() {
|
||||
if (_state.value.current == null) {
|
||||
if (_state.value.isPlaying) pause()
|
||||
return
|
||||
}
|
||||
if (_state.value.isPlaying) pause() else play()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user