Skip to content

Implementing Media Controls for Voice Messages#6396

Open
rapterjet2004 wants to merge 2 commits into
masterfrom
issue-6066-media-controls
Open

Implementing Media Controls for Voice Messages#6396
rapterjet2004 wants to merge 2 commits into
masterfrom
issue-6066-media-controls

Conversation

@rapterjet2004

@rapterjet2004 rapterjet2004 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

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.

Screenshot 2026-07-06 at 11 43 04 AM

🚧 TODO

  • Get it working
  • Fix Pause/Play btn state
  • Allow seeking in UI
    • Seeking another messages seekbar also seeks the message next to it, when you play a another message before pausing the currently playing message.
  • Add Message MetaData to Control Notification
  • Allow waveforms
    • SeekBar speed should match Thumb, might need to do some math here
  • Make played seconds update -_-
    • Seconds played should count down from duration

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@rapterjet2004 rapterjet2004 self-assigned this Jun 29, 2026
@rapterjet2004 rapterjet2004 added the 2. developing Work in progress label Jun 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/28387969161/artifacts/7958660485
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/28952121735/artifacts/8172415540
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

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>
@rapterjet2004
rapterjet2004 force-pushed the issue-6066-media-controls branch from b58cc05 to 9d813d1 Compare July 8, 2026 15:31
@rapterjet2004
rapterjet2004 requested a review from mahibi July 8, 2026 15:37
@rapterjet2004 rapterjet2004 added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/28954900685/artifacts/8173612512
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

@mahibi mahibi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/29026472648/artifacts/8203959628
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

control playback of voice messages in androids notification panel

2 participants