有没有办法在Android的更换或沉默的相机快门声?没有办法、快门、沉默、相机

2023-09-04 23:35:21 作者:[挂念我]

我想,以取代快门声音别的东西在code(捕捉照片时相机发出的声音)。我希望它会像铃声或通知,但我没有看到任何其他的任何地方它。我见过code前右走的是事先知情同意,并右后unsilencing它沉默了电话,但我preFER替换为另一个MP3或OGG格式的声音。

I'd like to replace the shutter sound (the sound the camera makes when snapping a photo) with something else in code. I was hoping it would be like ringtones or notifications, but I don't see anything anywhere other about it. I've seen code to silence the phone right before taking the pic, and unsilencing it right after, but I'd prefer to replace the sound with another mp3 or ogg.

明白,如果你有一个根深蒂固的电话,您可以替换该文件。这不是对我的应用程序中的溶液

Understand if you have a rooted phone, you can replace the file. This is not a solution for my app.

就在我的应用程序。想法是将其设置,然后取消它。有趣的是,你输入一些东西出来后,再阅读它,它有助于从不同的角度想起来。我已经使用了code以下关闭音频服务,我右打前我的声音。工程作为一个伟大的解决办法。也许有一天,我们就可以将其设置。

Just in my app. Idea would be to set it, then unset it. Funny how after you type something out, re-read it, it helps think of it from a different perspective. I've used the code below to shut down the audio service, and I play my sound right before. Works as a great workaround. Perhaps someday, we'll be able to set it.

   AudioManager mgr = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
   mgr.setStreamMute(AudioManager.STREAM_SYSTEM, true); 

谢谢!

推荐答案

,你可以提供一个相机。 ShutterCallback 键,播放任何你想要的。

If you are using the Camera object, you can supply a Camera.ShutterCallback and play whatever you want.

如果您使用的是意图启动其他应用程序来拍照时,该应用程序就可以选择什么播放拍照时。

If you are using an Intent to launch another app to take the picture, that app gets to choose what it plays when the picture is taken.

您静音的音频解决方案,为用户敌视,因为如果有需要在那段时间播放系统声音别的,用户将不会听到它。

Your mute-the-audio solution is user-hostile, as if there is anything else that needs to play a system sound during that period of time, the user won't hear it.