Show voice message preview player progress (#1675)
* Show voice message preview player progress * Update screenshots * Fix test * Some nits over mediaplayer stuff --------- Co-authored-by: ElementBot <benoitm+elementbot@element.io> Co-authored-by: Marco Romano <marcor@element.io>
This commit is contained in:
parent
21499a2d40
commit
8121d1a6de
13 changed files with 102 additions and 41 deletions
|
|
@ -47,6 +47,7 @@ class MediaPlayerImpl @Inject constructor(
|
|||
_state.update {
|
||||
it.copy(
|
||||
currentPosition = player.currentPosition,
|
||||
duration = player.duration.coerceAtLeast(0),
|
||||
isPlaying = isPlaying,
|
||||
)
|
||||
}
|
||||
|
|
@ -61,6 +62,7 @@ class MediaPlayerImpl @Inject constructor(
|
|||
_state.update {
|
||||
it.copy(
|
||||
currentPosition = player.currentPosition,
|
||||
duration = player.duration.coerceAtLeast(0),
|
||||
mediaId = mediaItem?.mediaId,
|
||||
)
|
||||
}
|
||||
|
|
@ -74,7 +76,7 @@ class MediaPlayerImpl @Inject constructor(
|
|||
private val scope = CoroutineScope(Job() + Dispatchers.Main)
|
||||
private var job: Job? = null
|
||||
|
||||
private val _state = MutableStateFlow(MediaPlayer.State(false, null, 0L))
|
||||
private val _state = MutableStateFlow(MediaPlayer.State(false, null, 0L, 0L))
|
||||
|
||||
override val state: StateFlow<MediaPlayer.State> = _state.asStateFlow()
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ interface SimplePlayer {
|
|||
fun addListener(listener: Listener)
|
||||
val currentPosition: Long
|
||||
val playbackState: Int
|
||||
val duration: Long
|
||||
fun clearMediaItems()
|
||||
fun setMediaItem(mediaItem: MediaItem)
|
||||
fun getCurrentMediaItem(): MediaItem?
|
||||
|
|
@ -73,6 +74,8 @@ class SimplePlayerImpl(
|
|||
get() = p.currentPosition
|
||||
override val playbackState: Int
|
||||
get() = p.playbackState
|
||||
override val duration: Long
|
||||
get() = p.duration
|
||||
|
||||
override fun clearMediaItems() = p.clearMediaItems()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue