13

I can snap a picture with the iPhone programmatically by calling [UIImagePickerController takePicture:], but when I do the iPhone plays a loud recording of a shutter click. When I google for how to turn off the click, I find advice to rename the sound file that the iPhone plays. It seems to me for my app to do that would lead to it being rejected from the App store for accessing system frameworks. Is there a programmatic way to shut off that sound? The nature of my app demands that the camera be silent.

Community
  • 1
  • 1
Mike Crawford
  • 2,232
  • 2
  • 18
  • 28
  • 1
    I would like to do this as well - I have attempted to record lots of still images quickly (thru AVCaptureStillImageOutput), and the non-stop shutter sound is quite unwelcome in this regard. – Thomas Tempelmann Jun 25 '12 at 17:26
  • 1
    As others have stated, this puts you on the wrong side of the law in several countries. – Hot Licks Jul 30 '13 at 03:04

4 Answers4

5

I assume you have solved it since but your app supposed to fail on the Appstore validation as it doesn't comply with iOS Dev License agreement. See below:

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.

Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
Zoltan Magyar
  • 874
  • 1
  • 6
  • 19
  • 1
    A "reasonably conspicuous audio, visual or other indicator must be displayed to the user" - so as long as the OP provides visual indication that recording is taking place, the sound could still be turned off as long as it didn't conflict with local privacy laws, in which case the app could simply leave the sound on for some markets. – Simon MᶜKenzie Jun 06 '12 at 03:53
  • You can interpret it on several ways. But in this case only Apple interpretation counts as they will just reject your app (as they did ours) if the camera is taking pictures silently. – Zoltan Magyar Jun 26 '12 at 13:29
  • I have 3 apps live in the AppStore that were not rejected because of this issue but on all 3 apps we notified the users that the camera was enabled. – Albert Renshaw Oct 11 '12 at 21:04
1

For what it's worth, I was able to get this to work by using this code in the snapStillImage method of AVCapture framework using AVCaptureStillImageOutput. It works perfectly for me on iOS 8.3 iPhone 5. I have also confirmed that Apple won't reject your app if you use this:

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];

Swift 4:

var volumeView = MPVolumeView()
//find the volumeSlider
var volumeViewSlider: UISlider? = nil
for view: UIView in volumeView.subviews {
    if (view.self.description == "MPVolumeSlider") {
        volumeViewSlider = view as? UISlider
        break
    }
}

volumeViewSlider?.setValue(0.0, animated: true)
volumeViewSlider?.sendActions(for: .touchUpInside)
Frak
  • 832
  • 1
  • 11
  • 32
1

Not sure if you would want to do it... The sound is there to let someone know a photo is being taken. The idea is to ensure privacy and safety of the public, especially children," something that Japan has already required of their snap-happy citizens

Japan and Korea already have laws that require this sound when taking pictures.

http://abcnews.go.com/Technology/story?id=6750825&page=1

excerpt:

"In Japan and Korea, Segan pointed out, in response to mounting reports of "underskirting," governments have passed laws similar to the one King proposes."

clyc
  • 2,420
  • 14
  • 15
  • The user can silence the sound if they want to. I keep my phone on silent; the camera doesn't make a sound. It's special-cased for phones in Japan. – tc. Nov 21 '10 at 04:48
  • Also note: Video cameras don't make a constant sound, do they? So anyone could easily avoid being noticed by using video recording instead - especially since the iPhone camera doesn't show a red recording light that we usually see on dedicated video cameras. – Thomas Tempelmann Jun 25 '12 at 17:25
  • This is not an answer, but a mere opinion. – Fernando Cervantes Apr 21 '13 at 07:07
  • While this seems like good answer, the camera sound can easily be disabled by flipping the MUTE switch on the device to OFF, rendering the camera shutter sound completely silent. – WrightsCS Oct 31 '13 at 20:04
1

Renaming the sound file wouldn't be using a "private API"; it's simply not possible from within the sandbox (assuming you haven't broken out of the sandbox somehow).

However, on 4.0+, you can use AVCapture to take pictures instead. I'm not sure if AVCaptureStillImageOutput plays a shutter sound; a workaround is to use video frames.

I have to wonder what you mean by "the nature of my app" though. If you're trying to do some sort of live image processing, then video frames are a much better way to go in the first place. If you're trying to take pictures silently with the user's permission, then the user should be able to silence the shutter sound anyway. If you're trying to take pictures without the user's permission, you're probably violating some agreement with Apple.

tc.
  • 33,468
  • 5
  • 78
  • 96