Playing camera sound only once for for multiple images using AVFoundation OR Simply mute/suppress sound programmatically
Asked Answered
K

3

10

In reference to Question 1,Question 2,Question 3, I am having similar question on same platform.

I am capturing multiple images (5 images - Kind of Burst mode in 1.5 sec) using AVFoundation, I am able to snap 5 images successfully but it makes shutter sound each time new image is taken.

I am using captureStillImageAsynchronouslyFromConnection for still images. Image quality/clarity is my main focus, I don't want to compromise in Image quality and Image capturing speed.

My Queries are:

1) Can I play sound only once ie. for first image only and not for all 5 images.

2) Can I change the shutter sound, if yes, How?.

3) Will apple approve such apps if changes are incorporated.

I am aware about App Store policy for shutter sound as per Section 3.3.8.

User Interface, Data Collection, Local Laws and Privacy:

Section 3.3.8 : Any form of user or device data collection, or image, picture or voice capture or recording (collectively “Recordings”), and any form of data, content or information collection, processing, maintenance, uploading, syncing, storage, transmission, sharing, disclosure or use performed by, through or in connection with Your Application must comply with all applicable privacy laws and regulations as well as any related Program Requirements, including but not limited to any notice or consent requirements. In particular, a reasonably conspicuous audio, visual or other indicator must be displayed to the user as part of the Application to indicate that a Recording is taking place.

It is also fine if we can mute/totally suppress Camera shutter sound (no sound at all).

Katzir answered 8/4, 2015 at 6:26 Comment(0)
V
3

I've used the method you've posted in Question 1 and it works like magic. So I highly recommend you follow the best answer's example.

Regarding your queries:

1) You can have the sound for the first picture only by combining the solution of the example wrapped in a boolean that checks if the first picture has been taken or not. For example:

if (hasTakenFirstPicture) {
    static SystemSoundID soundID = 0;
    if (soundID == 0) {
        NSString *path = [[NSBundle mainBundle] pathForResource:@"photoShutter2" ofType:@"caf"];
        NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
        AudioServicesCreateSystemSoundID((__bridge CFURLRef)filePath, &soundID);
    }
    AudioServicesPlaySystemSound(soundID);
} else {
    hasTakenFirstPicture = YES;
}
[self.stillImageOutput captureStillImageAsynchronouslyFromConnection:
...

2) You can't change the default shutter sound.

3) The app store review guidelines makes no mention on rejecting an app for altering the shutter sound, so you're pretty much covered here. They should only ever reject your app if the app you submit does not meet any of the criteria specified on the list.

Hope this helps!

Vulpecula answered 22/5, 2015 at 12:49 Comment(1)
Got my app rejected for using this method. Comment from review team - "...Specifically, your app auto-disables the shutter sound of the camera when a photo is taken." Apple PLA clause 3.3.8Fecula
C
2

In some countries (like japan/china I think) the shutter sound is mandatory when taking pictures. So this could get your app denied for these countries. Or at least give you some kind of trouble.

Either way, a good workaround for that which could also help you with your problem, is doing the following. Note that quality would be a bit less but would require testing to make sure :

Taking a video is another solution, and snap 5 pictures of the video (every 0.3 seconds for example). So instead of taking 5 pics you're taking 1 video and programatically editing it.

Videos also don't require shutter clicks, so you can programatically (using SystemSounds) play any sound you would like.

The user wouldn't notice the difference, but because it's a video, the quality might be less and the way the camera handles the image might be different too.

I still think it's worth trying :)

Coon answered 22/5, 2015 at 13:6 Comment(0)
L
0

I was able to disable/mute the camera shutter sound while taking screenshot programmatically using the below code. Confirmed to work on iOS8.3 on iPhone 5 and accepted in App store. Call this code just before taking your picture:

MPVolumeView* volumeView = [[MPVolumeView alloc] init];
//find the volumeSlider
UISlider* volumeViewSlider = nil;
for (UIView *view in [volumeView subviews]){
    if ([view.class.description isEqualToString:@"MPVolumeSlider"]){
        volumeViewSlider = (UISlider*)view;
        break;
    }
}

[volumeViewSlider setValue:0.0f animated:YES];
[volumeViewSlider sendActionsForControlEvents:UIControlEventTouchUpInside];
Laudation answered 29/7, 2015 at 14:21 Comment(1)
The title of the questions says "... OR Simply mute/suppress sound programatically". That's what the code snippet does. I was just sharing in case it was useful.Laudation

© 2022 - 2025 — McMap. All rights reserved.