如何让 iPhone 相机的快门声静音?

发布于 2024-10-03 17:49:28 字数 216 浏览 5 评论 0原文

我可以通过调用 [UIImagePickerController takePicture:] 以编程方式使用 iPhone 拍摄照片,但当我这样做时,iPhone 会播放快门点击的响亮录音。当我在谷歌上搜索如何关闭点击声时,我找到了重命名 iPhone 播放的声音文件的建议。在我看来,我的应用程序这样做会导致它因访问系统框架而被应用程序商店拒绝。有没有一种编程方法可以关闭该声音?我的应用程序的性质要求相机保持安静。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

熟人话多 2024-10-10 17:49:28

我假设您已经解决了这个问题,但您的应用程序应该在 Appstore 验证中失败,因为它不符合 iOS 开发许可协议。见下文:

第 3.3.8 节:任何形式的用户或设备数据收集或图像、
图片或语音捕获或录音(统称为“录音”),以及
任何形式的数据、内容或信息收集、处理、
维护、上传、同步、存储、传输、分享、
由您、通过您或与您相关的披露或使用
应用程序必须遵守所有适用的隐私法和
法规以及任何相关计划要求,包括但
不限于任何通知或同意要求。特别是,一个
必须有相当显眼的音频、视频或其他指示器
作为应用程序的一部分向用户显示,以表明
录音正在进行中。

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.

薄凉少年不暖心 2024-10-10 17:49:28

不确定你是否愿意这样做......
发出声音是为了让某人知道正在拍照。这个想法是为了确保公众,特别是儿童的隐私和安全,”日本已经对其爱拍照的公民提出了这一要求。

日本和韩国已经制定了法律,要求在拍照时发出这种声音。

http://abcnews.go.com/Technology/story?id=6750825&page=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."

伴梦长久 2024-10-10 17:49:28

重命名声音文件不会使用“私有 API”;在沙箱内这是不可能的(假设你没有以某种方式突破沙箱)。

但是,在 4.0+ 上,您可以使用 AVCapture 来代替拍照。我不确定 AVCaptureStillImageOutput 是否播放快门声音;解决方法是使用视频帧。

我想知道你所说的“我的应用程序的性质”是什么意思。如果您正在尝试进行某种实时图像处理,那么视频帧首先是一个更好的方法。如果您尝试在用户许可的情况下安静地拍照,那么用户无论如何都应该能够使快门声音静音。如果您在未经用户许可的情况下尝试拍照,则可能违反了与 Apple 达成的某些协议。

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.

甜是你 2024-10-10 17:49:28

无论如何,我可以通过使用 AVCaptureStillImageOutput 在 AVCapture 框架的 snapStillImage 方法中使用此代码来使其工作。它在 iOS 8.3 iPhone 5 上完美运行。我还确认,如果您使用此功能,Apple 不会拒绝您的应用程序:

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)

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)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文