如何关闭MediaRecorder播放状态改变时的声音 [英] How to shut off the sound MediaRecorder plays when the state changes

查看:2627
本文介绍了如何关闭MediaRecorder播放状态改变时的声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Andr​​oid应用程序使用一个SurfaceHolder MediaRecorder显示的摄像头所拍摄的现场preVIEW。每当用户presses上的应用程序的REC键,应用程序开始记录。 每次MediaRecorder的状态切换到/从'开始',机器人自动(?)触发了蜂鸣声。这发出哔哔声从手机不同的手机,这让我觉得这嘟嘟声本地连接到MediaRecorder的状态变化。 哔声没玩过如果手机的音量设置为静音。

我谷歌,并做了一些研究,但我无法找到一个方法来关闭这个提示音关闭。可能吗?如果是这样,怎么样?

该应用程序是在测试:Nexus One的2.3.4,Desire HD的2.3.3

解决方案

尝试

<$p$p><$c$c>((AudioManager)context.getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_SYSTEM,true);

这静音所有声音。

My Android application uses MediaRecorder on a SurfaceHolder to show a live preview of what the camera is capturing. Every time the user presses the REC button on the app, the app starts to record. Every time the state of the MediaRecorder switches to/from 'start', Android automatically (?) fires off a beep. This beep sounds different from phone to phone, which makes me think that this beep is natively attached to the state change of MediaRecorder. The beep is not played if the volume of the phone is set to silent.

I google it and did some research but I couldn't find a way to turn this beep off. Is it possible? If so, how?

The app was tested on: Nexus One 2.3.4, Desire HD 2.3.3

解决方案

try

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

That mute all sounds.

这篇关于如何关闭MediaRecorder播放状态改变时的声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆