Implementing Media Controls for Voice Messages#6396
Conversation
|
APK file: https://github.com/nextcloud/talk-android/actions/runs/28387969161/artifacts/7958660485 |
|
APK file: https://github.com/nextcloud/talk-android/actions/runs/28952121735/artifacts/8172415540 |
Changing source of truth of voice messages to be MediaSessionService Added a bunch of code to handle updates to the player, listen to state changes, and update the UI Fixed waveforms, they are now drawn in bounds detekt Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
b58cc05 to
9d813d1
Compare
|
APK file: https://github.com/nextcloud/talk-android/actions/runs/28954900685/artifacts/8173612512 |
mahibi
left a comment
There was a problem hiding this comment.
Works good so far 👍 Some findings to improve in this or followup PRs:
-
there should be the talk icon the the status bar when the talk app is playing a voice message
-
clicking on the playback panel should open the chat where the message is played (best would be to scroll to the played back message of course)
-
during playing one voice message, i can't start playback of some other voice message. I need to pause the prior message first
-
playback speed is not yet re-implemented (was also missing before, since the chatkit removal maybe)
-
there is quite some dead code now in ChatViewModel? Like this:
fun setPlayBack(speed: PlaybackSpeed) { mediaPlayerManager.setPlayBackSpeed(speed) viewModelScope.launch { _voiceMessagePlayBackUIFlow.emit(speed) } } fun startMediaPlayer(path: String) { audioRequest(true) { mediaPlayerManager.start(path) } } fun startCyclingMediaPlayer() = audioRequest(true, mediaPlayerManager::startCycling) fun pauseMediaPlayer(notifyUI: Boolean) { audioRequest(false) { mediaPlayerManager.pause(notifyUI) } } fun seekToMediaPlayer(progress: Int) = mediaPlayerManager.seekTo(progress) fun stopMediaPlayer() = audioRequest(false, mediaPlayerManager::stop) fun queueInMediaPlayer(path: String, msg: ChatMessage) = mediaPlayerManager.addToPlayList(path, msg) fun clearMediaPlayerQueue() = mediaPlayerManager.clearPlayList()and probably more.
|
APK file: https://github.com/nextcloud/talk-android/actions/runs/29026472648/artifacts/8203959628 |
Harder than I thought, this required refactoring the entire media player io logic to use MediaSessionService as it's source of truth. While this simplifies the architecture a bit, it also means I have to go about and fix some old bugs once again.
Further follow up PR's would be to move more logic into the view model and simplify chat activity and changing how MediaPlayerManager is used.
🚧 TODO
🏁 Checklist
/backport to stable-xx.x🤖 AI (if applicable)