简体   繁体   English

Android-在连接了蓝牙扬声器的内部电话扬声器上播放音频

[英]Android - playback audio on internal phone speaker with bluetooth speaker connected

My setup: Android 4.4 tablet connected with Sony bluetooth speakers. 我的设置:Android 4.4平板电脑与Sony蓝牙扬声器连接。 Spotify is playing music on the bluetooth speaker. Spotify正在通过蓝牙扬声器播放音乐。

Using 运用

audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audio.setStreamVolume(AudioManager.STREAM_NOTIFICATION, audio.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION), 0);
soundPool = new SoundPool(20, AudioManager.STREAM_NOTIFICATION, 0);
SoundBeeps = soundPool.load(this,R.raw.beeps,1);
soundPool.play(SoundBeeps, 1, 1, 0, 0, 1);`

the notification sound is played back on both the internal and the bluetooth speaker. 通知声音会在内置扬声器和蓝牙扬声器上播放。

Is it possible to play a notification sound only on the tablet's internal speaker, not on the bluetooth speaker? 是否可以在平板电脑的内置扬声器上播放通知声音,而不能在蓝牙扬声器上播放通知声音?

soundPool = new SoundPool(20, AudioManager.STREAM_NOTIFICATION, 0);

the argument AudioManager.STREAM_NOTIFICATION here is responsibe to make it play in that manner 这里的参数AudioManager.STREAM_NOTIFICATION负责使其以这种方式播放
I have not tried this but type this AudioManager.STREAM_ and hit ctrl+space you will get recommendations and use each one and test 我没有尝试过,但是键入此AudioManager.STREAM_并按ctrl + space键,您将获得建议并使用每一个并进行测试

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

相关问题 制作带有播放控件的蓝牙扬声器连接到手机 - Making a Bluetooth speaker with playback controls connected to phone Android:在蓝牙和手机扬声器之间切换音频是不一致的 - Android : Switching audio between Bluetooth and Phone Speaker is inconsistent 播放Android设备的音频槽手机扬声器 - Play audio trough phone speaker of an android device Android App连接到Rhode麦克风以及蓝牙扬声器 - Android App connected to Rhode microphone as well as Bluetooth speaker 向内部扬声器发出android通知声音,向蓝牙扬声器(a2dp)发出所有其他通知(音乐,通话,警报) - Rout android notification sound to internal speaker and all the other (music,calls,alerts) to bluetooth speaker (a2dp) Android 蓝牙应用程序将手机连接到智能扬声器全双工? - Android bluetooth app to connect phone to smart speaker full-duplex? 在Android上检测到使用蓝牙耳机或扬声器拨打的电话 - Detected phone call taken with bluetooth headset or speaker on Android 如何在 flutter android 中将音频 output 从扬声器电话更改为听筒? - How to change the audio output from speaker phone to earpiece in flutter android? 如何检测音频当前是否在Android手机扬声器上播放? - How to detect if the audio is currently playing on an Android phone speaker? 通过远程连接的蓝牙扬声器保持音量 - Maintain volume with remotely connected bluetooth speaker
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM