File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
package/src/components/MessageInput/hooks Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { Alert, Platform } from 'react-native';
44
55import { LocalVoiceRecordingAttachment } from 'stream-chat' ;
66
7+ import { useActiveAudioPlayer } from '../../../contexts/audioPlayerContext/AudioPlayerContext' ;
78import { useMessageComposer } from '../../../contexts/messageInputContext/hooks/useMessageComposer' ;
89
910import { useMessageInputContext } from '../../../contexts/messageInputContext/MessageInputContext' ;
@@ -54,6 +55,7 @@ export const useAudioController = () => {
5455 const [ recordingDuration , setRecordingDuration ] = useState < number > ( 0 ) ;
5556 const [ recordingStatus , setRecordingStatus ] = useState < RecordingStatusStates > ( 'idle' ) ;
5657 const { attachmentManager } = useMessageComposer ( ) ;
58+ const activeAudioPlayer = useActiveAudioPlayer ( ) ;
5759
5860 const { sendMessage } = useMessageInputContext ( ) ;
5961
@@ -256,6 +258,9 @@ export const useAudioController = () => {
256258 }
257259 setRecording ( recording ) ;
258260 setRecordingStatus ( 'recording' ) ;
261+ if ( activeAudioPlayer ?. isPlaying ) {
262+ await activeAudioPlayer ?. pause ( ) ;
263+ }
259264 await stopVoicePlayer ( ) ;
260265 } else {
261266 setPermissionsGranted ( false ) ;
You can’t perform that action at this time.
0 commit comments