Skip to content

Commit

Permalink
ui: Improved the player UI (mini and full screen)
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Fontán <[email protected]>
  • Loading branch information
BobbyESP committed Apr 28, 2024
1 parent ce34efa commit 862e672
Show file tree
Hide file tree
Showing 7 changed files with 283 additions and 143 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ object MediaPlayerModule {
@ApplicationContext context: Context,
player: ExoPlayer
): MediaSession =
MediaSession.Builder(context, player).build()
MediaSession.Builder(context, player)
.build()

@Provides
@Singleton
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
package com.bobbyesp.mediaplayer.service

import android.util.Log
import androidx.annotation.OptIn
import androidx.media3.common.util.UnstableApi
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.update

@OptIn(UnstableApi::class)
sealed class ConnectionState {
data object Disconnected : ConnectionState()
data class Connected(val serviceHandler: MediaServiceHandler) : ConnectionState()
}

@OptIn(UnstableApi::class)
class ConnectionHandler {
private val _connectionState = MutableStateFlow<ConnectionState>(ConnectionState.Disconnected)
val connectionState: StateFlow<ConnectionState> = _connectionState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class MediaServiceHandler @Inject constructor(
private val _mediaState = MutableStateFlow<MediaState>(MediaState.Idle)
val mediaState = _mediaState.asStateFlow()

private val _playerActions = MutableStateFlow<PlayerEvent?>(null)
val playerActions = _playerActions.asStateFlow()

val isThePlayerPlaying: MutableStateFlow<Boolean> = MutableStateFlow(false)

private var job: Job? = null
Expand Down
Loading

0 comments on commit 862e672

Please sign in to comment.