mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Add variable playback speed feature for voice messages
Add playback speed control for voice messages with support for 0.5×, 1×, 1.5×, and 2× playback speeds. The speed button is displayed above the timestamp and cycles through the available speeds when tapped.
This commit is contained in:
+1
@@ -10,4 +10,5 @@ package io.element.android.libraries.voiceplayer.api
|
||||
sealed interface VoiceMessageEvents {
|
||||
data object PlayPause : VoiceMessageEvents
|
||||
data class Seek(val percentage: Float) : VoiceMessageEvents
|
||||
data object ChangePlaybackSpeed : VoiceMessageEvents
|
||||
}
|
||||
|
||||
+1
@@ -12,6 +12,7 @@ data class VoiceMessageState(
|
||||
val progress: Float,
|
||||
val time: String,
|
||||
val showCursor: Boolean,
|
||||
val playbackSpeed: Float,
|
||||
val eventSink: (event: VoiceMessageEvents) -> Unit,
|
||||
) {
|
||||
enum class Button {
|
||||
|
||||
+2
@@ -47,10 +47,12 @@ fun aVoiceMessageState(
|
||||
progress: Float = 0f,
|
||||
time: String = "1:00",
|
||||
showCursor: Boolean = false,
|
||||
playbackSpeed: Float = 1.0f,
|
||||
) = VoiceMessageState(
|
||||
button = button,
|
||||
progress = progress,
|
||||
time = time,
|
||||
showCursor = showCursor,
|
||||
playbackSpeed = playbackSpeed,
|
||||
eventSink = {},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user