Skip to content

Commit 079e1c3

Browse files
committed
fix: tests for audio controller
1 parent 9178b44 commit 079e1c3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

package/src/components/MessageInput/hooks/useAudioController.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ export const useAudioController = () => {
8888
if (progress === 0) await startVoicePlayer();
8989
else {
9090
// For Native CLI
91-
if (Audio.resumePlayer) await Audio.resumePlayer();
91+
if (Audio?.resumePlayer) await Audio.resumePlayer();
9292
// For Expo CLI
9393
if (soundRef.current?.playAsync) await soundRef.current.playAsync();
9494
}
9595
} else {
9696
// For Native CLI
97-
if (Audio.pausePlayer) await Audio.pausePlayer();
97+
if (Audio?.pausePlayer) await Audio.pausePlayer();
9898
// For Expo CLI
9999
if (soundRef.current?.pauseAsync) await soundRef.current.pauseAsync();
100100
}
@@ -107,7 +107,7 @@ export const useAudioController = () => {
107107
const startVoicePlayer = async () => {
108108
if (!recording) return;
109109
// For Native CLI
110-
if (Audio.startPlayer)
110+
if (Audio?.startPlayer)
111111
await Audio.startPlayer(recording, {}, onVoicePlayerPlaybackStatusUpdate);
112112
// For Expo CLI
113113
if (recording && typeof recording !== 'string') {
@@ -133,7 +133,7 @@ export const useAudioController = () => {
133133
*/
134134
const stopVoicePlayer = async () => {
135135
// For Native CLI
136-
if (Audio.stopPlayer) {
136+
if (Audio?.stopPlayer) {
137137
await Audio.stopPlayer();
138138
}
139139
// For Expo CLI

0 commit comments

Comments
 (0)