Skip to content

Commit

Permalink
fix: remove redundant console.logs from Audio.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
khushal87 committed May 16, 2024
1 parent 851d314 commit a9a308a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
3 changes: 0 additions & 3 deletions package/expo-package/src/handlers/Audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ export const Audio = AudioComponent
? {
startRecording: async (recordingOptions: RecordingOptions, onRecordingStatusUpdate) => {
try {
console.log('Requesting permissions..');
const permissionsGranted = await AudioComponent.getPermissionsAsync().granted;
if (!permissionsGranted) {
await AudioComponent.requestPermissionsAsync();
Expand All @@ -225,7 +224,6 @@ export const Audio = AudioComponent
allowsRecordingIOS: true,
playsInSilentModeIOS: true,
});
console.log('Starting recording..');
const androidOptions = {
audioEncoder: AndroidAudioEncoder.AAC,
extension: '.aac',
Expand Down Expand Up @@ -258,7 +256,6 @@ export const Audio = AudioComponent
},
stopRecording: async () => {
try {
console.log('Stopping recording..');
await AudioComponent.setAudioModeAsync({
allowsRecordingIOS: false,
});
Expand Down
14 changes: 6 additions & 8 deletions package/native-package/src/optionalDependencies/Audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,13 @@ const verifyAndroidPermissions = async () => {
export const Audio = AudioRecorderPackage
? {
pausePlayer: async () => {
console.log('Pause Player..');
await audioRecorderPlayer.pausePlayer();
},
resumePlayer: async () => {
console.log('Resume Player..');
await audioRecorderPlayer.resumePlayer();
},
startPlayer: async (uri, _, onPlaybackStatusUpdate) => {
try {
console.log('Starting Player..');
const playback = await audioRecorderPlayer.startPlayer(uri);
console.log({ playback });
audioRecorderPlayer.addPlayBackListener((status) => {
Expand All @@ -191,7 +188,6 @@ export const Audio = AudioRecorderPackage
}
},
startRecording: async (options: RecordingOptions, onRecordingStatusUpdate) => {
console.log('Starting recording..');
if (Platform.OS === 'android') {
try {
await verifyAndroidPermissions();
Expand Down Expand Up @@ -230,12 +226,14 @@ export const Audio = AudioRecorderPackage
}
},
stopPlayer: async () => {
console.log('Stopping player..');
await audioRecorderPlayer.stopPlayer();
audioRecorderPlayer.removePlayBackListener();
try {
await audioRecorderPlayer.stopPlayer();
audioRecorderPlayer.removePlayBackListener();
} catch (error) {
console.log(error);
}
},
stopRecording: async () => {
console.log('Stopping recording..');
await audioRecorderPlayer.stopRecorder();
audioRecorderPlayer.removeRecordBackListener();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,9 @@ export const useAudioController = () => {
await Audio.stopPlayer();
}
// For Expo CLI
if (recording && typeof recording !== 'string') {
if (soundRef.current?.stopAsync && soundRef.current?.unloadAsync) {
await soundRef.current.stopAsync();
await soundRef.current?.unloadAsync();
}
if (soundRef.current?.stopAsync && soundRef.current?.unloadAsync) {
await soundRef.current.stopAsync();
await soundRef.current?.unloadAsync();
}
};

Expand Down

0 comments on commit a9a308a

Please sign in to comment.