Add playback speed control to voice messages #4482
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an implementation of the feature request in issue 3786:
"Allow voice messages to be played at different speeds"
This PR should not be considered final. There are a few questions to be answered first, I cannot do that myself, however. I need someone from inside the project for that. So this is more a "request for comment" than a PR ;-)
The current implementation does not at all offer a fancy design. The UI is as simplistic as possible.
I could very well imagine a button that extends when clicked and offers the options in parallel instead of cycling through the offered options as it is currently implemented. But that certainly is something a design expert has to decide.
The current implementation has 4 speeds it offers (opposed to WhatsApp offering 3): 0.8x, 1.0x, 1.5x, 2.0x. I added the slow variant since that could sometimes help to understand messages with bad acoustics.
The chosen speed is persisted on a per-user base. This appeared intuitive to me, since usually individual users keep their typical talking speed. Which means that if there is a need to change the playback speed that change probably makes sense for all voice messages of that user.
I would need some advice about the testing strategy in this project ... When trying to implement tests I found that next to no tests and test structure exist. I assume I miss something here ...
Seems I found a bug in how the message view holders are handled: their onBind() method is called over and over again when a voice message is played. That might be triggered by updating the progress slider. This behaviour repaints the view holder millions of times which actually creates quite a load on the system ...
I am thankful for any feedback on this!
🖼️ Screenshots
🚧 TODO
🏁 Checklist
/backport to stable-xx.x