mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-17 04:20:00 +03:00
Fix voice recorder start/pause states.
This commit is contained in:
parent
4254f46065
commit
3bd4a4ccd3
2 changed files with 5 additions and 3 deletions
|
@ -132,9 +132,11 @@ class VoiceMessageHelper @Inject constructor(
|
|||
}
|
||||
|
||||
fun startOrPausePlayback(id: String, file: File) {
|
||||
stopPlayback()
|
||||
val playbackState = playbackTracker.getPlaybackState(id)
|
||||
mediaPlayer?.stop()
|
||||
stopPlaybackTicker()
|
||||
stopRecordingAmplitudes()
|
||||
if (playbackTracker.getPlaybackState(id) is VoiceMessagePlaybackTracker.Listener.State.Playing) {
|
||||
if (playbackState is VoiceMessagePlaybackTracker.Listener.State.Playing) {
|
||||
playbackTracker.pausePlayback(id)
|
||||
} else {
|
||||
startPlayback(id, file)
|
||||
|
|
|
@ -115,7 +115,7 @@ class VoiceMessagePlaybackTracker @Inject constructor() {
|
|||
}
|
||||
}
|
||||
|
||||
fun getPercentage(id: String): Float {
|
||||
private fun getPercentage(id: String): Float {
|
||||
return when (val state = states[id]) {
|
||||
is Listener.State.Playing -> state.percentage
|
||||
is Listener.State.Paused -> state.percentage
|
||||
|
|
Loading…
Add table
Reference in a new issue