Fix voice message playback and end sound order
This commit is contained in:
parent
08e2716e6e
commit
52fa2ddb03
2 changed files with 12 additions and 9 deletions
|
@ -12,6 +12,7 @@ import {
|
|||
} from '../ducks/audioPlayer';
|
||||
import { globalMessageAudio } from '../../services/globalMessageAudio';
|
||||
import { strictAssert } from '../../util/assert';
|
||||
import { drop } from '../../util/drop';
|
||||
import * as log from '../../logging/log';
|
||||
import { Sound, SoundType } from '../../util/Sound';
|
||||
import { getConversations } from '../selectors/conversations';
|
||||
|
@ -20,10 +21,10 @@ import { markViewed } from '../ducks/conversations';
|
|||
import * as Errors from '../../types/errors';
|
||||
import { usePrevious } from '../../hooks/usePrevious';
|
||||
|
||||
const stateChangeConfirmUpSound = new Sound({
|
||||
const stateChangeConfirmDownSound = new Sound({
|
||||
soundType: SoundType.VoiceNoteStart,
|
||||
});
|
||||
const stateChangeConfirmDownSound = new Sound({
|
||||
const stateChangeConfirmUpSound = new Sound({
|
||||
soundType: SoundType.VoiceNoteEnd,
|
||||
});
|
||||
|
||||
|
@ -128,10 +129,12 @@ export function SmartVoiceNotesPlaybackProvider(
|
|||
});
|
||||
|
||||
if (playNextConsecutiveSound) {
|
||||
// eslint-disable-next-line more/no-then
|
||||
void stateChangeConfirmUpSound.play().then(() => {
|
||||
drop(
|
||||
(async () => {
|
||||
await stateChangeConfirmDownSound.play();
|
||||
globalMessageAudio.play();
|
||||
});
|
||||
})()
|
||||
);
|
||||
} else {
|
||||
globalMessageAudio.play();
|
||||
}
|
||||
|
@ -220,7 +223,7 @@ function loadAudio({
|
|||
},
|
||||
onEnded() {
|
||||
if (playFinishConsecutiveSound) {
|
||||
void stateChangeConfirmDownSound.play();
|
||||
drop(stateChangeConfirmUpSound.play());
|
||||
}
|
||||
messageAudioEnded();
|
||||
},
|
||||
|
|
|
@ -124,11 +124,11 @@ export class Sound {
|
|||
}
|
||||
|
||||
if (soundStyle === SoundType.VoiceNoteEnd) {
|
||||
return 'sounds/state-change_confirm-down.ogg';
|
||||
return 'sounds/state-change_confirm-up.ogg';
|
||||
}
|
||||
|
||||
if (soundStyle === SoundType.VoiceNoteStart) {
|
||||
return 'sounds/state-change_confirm-up.ogg';
|
||||
return 'sounds/state-change_confirm-down.ogg';
|
||||
}
|
||||
|
||||
if (soundStyle === SoundType.Whoosh) {
|
||||
|
|
Loading…
Reference in a new issue