问题标签 [a2dp]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
690 浏览

android - 如何以编程方式将 A2DP 从移动设备连接到接收设备?

我必须在 android 2.3.3 上以编程方式将 A2DP 从移动设备连接到接收设备

我知道 Mac 地址和接收设备的名称,我将使用它们。

但我找不到任何 API 来做到这一点。

0 投票
4 回答
31479 浏览

java - 以编程方式连接到配对的蓝牙扬声器并播放音频

在我们的应用程序中,我想使用 Android v4.2 或更高版本连接到之前配对的 A2DP 蓝牙扬声器并直接播放音频。

我可以使用以下代码成功创建 A2DP 配置文件对象来启动该过程:



以及下面的监听器来响应连接:

对于现在要做什么,连接设备并将音频输出定向到它,我只是有点迷茫。我已尝试使用以下代码连接到设备,如 Android 文档中BluetoothSpeaker.getConnectedDevices()所述,但最终调用未返回连接的设备。

该代码似乎确实以某种方式连接到设备,因为当我停止执行时,蓝牙扬声器宣布它已准备好配对(就像它与音频源断开连接时一样)。

旧版本的BluetoothA2dp似乎有一种connect(BluetoothDevice device)方法,但现在已被删除(从 4.2 开始),我正在努力寻找任何明确的例子来说明如何以编程方式连接到 A2DP 设备,并将音频输出定向到它。任何有关如何处理的帮助都将不胜感激。

任何有关如何解决此问题的建议将不胜感激。

0 投票
1 回答
5204 浏览

android - 使用 AAC/mp3 编解码器从 android 流式传输 A2DP

众所周知,A2DP 中用于流式传输音频的默认编码是 SBC,但音质并不好。A2Dp 配置文件支持可选编解码器,如 mp3、aac 和 atrac。所以我有以下问题:

1) 市场上有没有使用 aac 或 mp3 进行 A2DP 流媒体的安卓手机?
2) 如果手机支持 A2DP 流媒体的 mp3/aac 编解码器,我们如何将默认编解码器从 SBC 更改为其他编解码器?
3) 我们如何在 google nexus 4 中启用此功能?

我正在使用运行 android 4.2.2 的 google nexus 4。任何帮助表示赞赏。

0 投票
1 回答
1166 浏览

dbus - Bluez(蓝牙)在连接时没有发送 DBUS method_call SelectConfiguration 吗?如果是这样,我该如何抓住它?

更新:尚未解决,但解决方案的一部分。见下文。

我正在尝试通过蓝牙将我的 iPod 或其他智能设备连接到我的笔记本电脑(Kubuntu 13.10),并将 a2dp 编码的音乐流式传输到蓝牙扬声器。别介意我为什么不直接连接它们。我在让设备实际配对然后同时连接时遇到了很多麻烦,但现在我能够做到这一点。有一百万篇文章描述了通过更改 .asoundrc、/etc/bluetooth/audio.conf 以及通过 PulseAudio 的控制器加载环回模块来连接 BT 耳机的不同方法。但是,我永远无法让 PulseAudio 始终加载源和接收器,所以我放弃了这个想法并开始关注 James B 的这篇精彩文章:http: //jamesbond3142.no-ip.org/blog/ ?viewCat=Bluetooth

我得到了编译的代码。它使用(更新的?)用于 BlueZ 的 DBus API。按照他的指示,我能够将音乐导入或导出 a2dp“服务器”,但没有声音。在代码中,他等待两个 DBUS 方法调用 SelectConfiguration 和 SetConfiguration 以获得“传输”,我认为这是一个句柄或文件描述符,描述了音频应该去往/来自哪里。但是,这些事件的处理程序永远不会被调用。我使用本指南设置 dbus-monitor 在系统总线上监听这些调用:https ://wiki.ubuntu.com/DebuggingDBus 。但是,方法调用不显示。再一次,我尝试在系统总线上收听任何方法调用,并且有一些在我知道正在调用的 dbus-monitor 中没有显示。(即注册端点)

我看到来自 org.bluez 的信号,但没有方法调用。在详细模式下运行 bluetoothd 时,当我连接设备时,我会得到类似的结果:

bluetoothd[12118]: 音频/a2dp.c:setup_ref() 0x7f9e8ffbdac0: ref=2 bluetoothd[12118]: audio/avdtp.c:avdtp_set_configuration() 0x7f9e8ffd03f0: int_seid=1, acp_seid=1 bluetoothd[12118]: 音频/a2dp .c:setup_unref() 0x7f9e8ffbdac0: ref=1 bluetoothd[12118]: audio/avdtp.c:session_cb() bluetoothd[12118]: audio/avdtp.c:avdtp_parse_resp() SET_CONFIGURATION 请求成功 bluetoothd[12118]: audio/a2dp .c:setconf_cfm() 源 0x7f9e8ffa4600: Set_Configuration_Cfm bluetoothd[12118]: audio/avdtp.c:avdtp_sep_set_state() 流状态已更改:IDLE -> CONFIGURED bluetoothd[12118]: audio/avdtp.c:session_cb() bluetoothd[12118] : audio/avdtp.c:avdtp_parse_resp() OPEN 请求成功

但在另一篇文章中,我看到有人有这个:

bluetoothd[8315]: 音频/a2dp.c:setup_ref() 0x7f1f8300b000: ref=2 bluetoothd[8315]: audio/avdtp.c:avdtp_set_configuration() 0x7f1f83012250: int_seid=2, acp_seid=1 bluetoothd[8315]: 音频/a2dp .c:setup_unref() 0x7f1f8300b000: ref=1 bluetoothd[8315]: audio/avdtp.c:session_cb() bluetoothd[8315]: audio/avdtp.c:avdtp_parse_resp() SET_CONFIGURATION 请求成功 bluetoothd[8315]: audio/a2dp .c:setconf_cfm() Sink 0x7f1f82fc3210: Set_Configuration_Cfm bluetoothd[8315]: audio/media.c:media_endpoint_async_call() 调用 SetConfiguration: name = :1.65 path = /MediaEndpoint/A2DPSink

bluetoothd[8315]: audio/avdtp.c:avdtp_sep_set_state() 流状态改变:IDLE -> CONFIGURED bluetoothd[8315]: audio/avdtp.c:session_cb() bluetoothd[8315]: audio/avdtp.c:avdtp_parse_resp() OPEN 请求成功

此时我有两个理论:1)当我的设备连接时,BlueZ 没有将它发送到我正在观看的总线 2)我没有正确观看(是否还需要使用 dbus_bus_add_match () 添加 method_calls ?)

我很难相信第二个,因为 James B 的代码为他工作,而我没有修改它。我正在使用 bluez 4.101 版。(我认为和他一样)很难找到 BlueZ 调用这些方法的确切条件。

当我启动程序时,我的 syslog 会这样说:

bluetoothd[8519]:端点注册:发送方=:1.166 path=/MediaEndpoint/A2DPSource

并在程序退出时取消注册。

目前我想不出要添加的其他细节,但如果我没有提供足够的信息,我很高兴。提前致谢。

更新 有点尴​​尬,但我今天绞尽脑汁想为什么 LINUX 系统不会获得文件句柄......嗯......所以我将sudo附加到程序调用(James B 的 a2dp-alsa 程序)并且它起作用了。至少对于输入设备。输出(BT 扬声器)仍然没有任何结果,但我会尽快弄清楚并在此处发布结果。

我在哪里收集我的菜鸟徽章?:(

0 投票
1 回答
12123 浏览

bluetooth - how to determine which codecs a bluetooth device supports over A2DP

I have a bluetooth device (headphones) that supports playing audio over A2DP. I've been pairing them with both an iPhone and an Android, and I get only extremely poor audio quality with both sources.

My suspicion is that the device only supports the SBC codec, but not Mp3. Or if it does MP3, only an abysmally low bitrate. The manufacturer only states A2DP is supported, but not which codecs.

How can I determine which codecs are supported? Is there a kind of protocol sniffer I could use on my phone or my computer and interrogate the device to get a definitive answer on what it supports?

0 投票
1 回答
3359 浏览

ios - AVAudioSessionPortBluetoothHFP、A2DP 和 LE 有什么区别?

Apple 的AVAudioSessionPortDescription参考中记录了三种不同的蓝牙相关音频端口类型。但苹果并没有对这三种类型做出太多解释。有人可以帮助解释更多吗?

0 投票
0 回答
2898 浏览

android - Android-蓝牙:如何将蓝牙连接到 A2DP 配置文件以通过扬声器流式传输音乐?

我想从我的手机连接到具有 A2DP 配置文件的蓝牙模块。然后我想让这个模块的扬声器播放我手机上的音乐。

我试过这个例子:A2DP蓝牙示例

但是当我运行它时,它给了我错误:无法绑定到蓝牙 A2DP 服务

我能做些什么呢?或者谁能​​给我另一个简单的例子?

0 投票
0 回答
1246 浏览

android - Control Remote with Bluetooth and Android

I am developing an app for bluetooth remote control a small robot (no, not arduino). The robot has a bluetooth chip (BK3221), which, from what I've gotten to know through their UUIDs works with A2DP and AVRCP protocols (oriented audio).

UUID 1: 0000110b-00000-1000-8000-00805f9b34fb

UUID 2: 0000110e-00000-1000-8000-00805f9b34fb

I can create the connection of the mobile and device through the connect() of Bluetooth A2DP classbut that is what I have, I have the proxy and the connected device but I do not know how to give information .

Moreover I tried program the connection in a basic way with functions for android with RFCOMM (which is supposed to support AVRCP). The robot is a closed system and I don´t know if it worked as a server or client (I assumed it was because the server because it accepts the conexion with the function "conect()" in the previous case). But when I call the connect function generates an exception BluetoothSocket me: "JSR82 connect connection is not created (failed or aborted)". I looked on JSR82 but gave me the feeling of being obsolete ...

If anyone has any idea of ​​something... Thanks

Code of the connection with BluetoothA2dp:

0 投票
1 回答
405 浏览

android - 蓝牙:将呼叫从源转移到接收器?

我有一部作为 SOURCE 的安卓手机(Samsung S Duos)和一部作为 SINK 的音频开发套件,即 CSR 8670。我正在尝试激活 a2dp 配置文件,然后将手机(Samsung S Duos)的来电转移到套件(CSR 8670)但无法实现。请帮助我克服这个问题。

0 投票
0 回答
466 浏览

qt - Qt for Android 上的 A2DP 支持?

我正在尝试开发一个通过蓝牙传输音频的 QT 应用程序。

所以我想知道 QT 是否支持 A2DP 配置文件,以及是否有任何示例代码可供我开始。是否有任何文档可以让我了解是否没有支持,以及我是否可以在未来的任何版本中获得支持?

另外,如果不支持 A2DP,我可以使用其他配置文件吗?