简体   繁体   English

通过SDK覆盖iPhone快门音

[英]Overriding iPhone shutter sound through SDK

In my iPhone app, I am using the UIImagePickerController with source type UIImagePickerControllerSourceTypeCamera. 在我的iPhone应用程序中,我正在使用源类型为UIImagePickerControllerSourceTypeCamera的UIImagePickerController。 When the user takes a picture, the phone plays the familiar camera shutter sound. 用户拍照时,手机会播放熟悉的相机快门声。 How can I replace this with my own custom sound? 如何用自己的自定义声音替换呢? I know it's possible because I've seen other apps from the App Store do it (eg Red Laser). 我知道这是有可能的,因为我已经看到App Store中的其他应用程序(例如Red Laser)做到了。

I am quite certain it's not possible. 我敢肯定这是不可能的。 AFAIK, Red Laser doesn't actually take a "normal" picture but uses UIGetScreenImage() (undocumented but nevertheless allowed for App Store apps) to make a screenshot of the live video feed. AFAIK,Red Laser实际上并不拍摄“正常”图片,而是使用UIGetScreenImage() (未记录,但App Store应用允许)来制作实时视频提要的屏幕截图。 Since the OS does not play sound on this occasion, they are free to play their own sound. 由于操作系统此时不播放声音,因此它们可以自由播放自己的声音。

Edit for clarification: As of OS 3.1, you are free to substitute the standard camera interface with your own controls. 编辑以澄清问题:从OS 3.1开始,您可以随意用自己的控件替换标准相机界面。 So you could place your own shutter button on the screen and play your own sound when the user taps it, but AFAIK there is now way to get rid of the OS's standard shutter sound. 因此,您可以在屏幕上放置自己的快门按钮,并在用户点击它时播放自己的声音,但是AFAIK现在可以摆脱操作系统的标准快门声音。

AFAIK the standard camera shutter sound cannot be changed via SDK. 不能通过SDK更改标准相机快门声。

This answer supports that. 这个答案支持这一点。 You can replace your own sound by switching sound files, but not in an app. 您可以通过切换声音文件来替换自己的声音,但不能在应用程序中。

Some answers such as this one suggest using AVCapture, but this method takes video screenshots, which reduces the image quality. 诸如此类的一些答案建议使用AVCapture,但是这种方法需要视频截图,从而降低了图像质量。 I 一世

t appears that you can't change the shutter sound because you could make it a silent sound, and capturing images covertly is against the App Store policy. 似乎无法更改快门音,因为您可以将其设为无声,并且秘密捕获图像违反了App Store的政策。 See this answer. 看到这个答案。

TLDR: TLDR:

The only way to change the shutter sound is to use a video screen grab. 更改快门声音的唯一方法是使用视频屏幕抓取。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM