【发布时间】:2013-12-18 04:00:03
【问题描述】:
我尝试了以下链接中的更改,但无济于事。
How to shut off the sound MediaRecorder plays when the state changes
我都试过了
AudioManager audioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
audioManager.setStreamMute(AudioManager.STREAM_SYSTEM, false);
audioManager.setStreamMute(AudioManager.STREAM_MUSIC,false);
和
// disable sound for recording.
// disable sound when recording.
((AudioManager)activity.getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_ALARM,true);
((AudioManager)activity.getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_DTMF,true);
((AudioManager)activity.getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_MUSIC,true);
((AudioManager)activity.getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_RING,true);
((AudioManager)activity.getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_SYSTEM,true);
((AudioManager)activity.getApplicationContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_VOICE_CALL,true);
但是当我启动媒体录音机时,我仍然可以听到声音。我尝试将这段代码放在应用程序的开头和直接之前:
mediaRecorder.start();
还有其他建议吗?
【问题讨论】:
-
那么你正在播放音乐,当你录制唱片时应该怎么停止呢?
-
不,我正在按顺序录制一系列视频并将它们保存到一个文件中,以便我可以分段下载整个视频。 MediaRecorder 在每个视频的开头播放快门声。我正在尝试关闭它,这样它就不会在序列中一遍又一遍地响起。
标签: android cordova audio mute