Cordoba no sound on bluetooth speakers

I am working on an android application (and IOS), the application plays audio messages without any problems. My problem is this: if the mobile phone is already connected to bluetooth (bluetooth is turned on and connected), if then I run the application and I play the audio file, in this case I can’t hear anything on the phone or the bluetooth speaker.

But if I launch my application and then activate bluetooth, then I play an audio file, there are no problems, the sound sounds good on my bluetooth speakers.

The solution that I used at the moment is that when I launch my application, I completely turn off bluetooth and then restart it on onDeviceready (using the cordova plugin), it works as if, but it is not perfect in quality solutions, it is very annoying for users that bluetooth disconnects and reconnects, especially when it is a bluetooth device.

Someone has the same problem and you can help me find another solution.

I use the latest versions of Cordoba (7.0.1), android (6.2.3) ... and I use plugova cordova-plugin-bluetoothle to restart bluetooth (disconnect it after launching the application)

Any idea please?

+2
source share
1 answer

! webapp Android (6.4.0) iOS (4.5.3), (7.1.0). API- webaudio . , :

Bluetooth , , . Android. / Android- , ... :

  • Samsung J3 (Android v5.1.1) =
  • LENOVO TB2 (Android v5.1.1) =
  • HUAWEI VTR (Android v7.0) =
  • LG G6 (Android v7.0) = !

, "" . , (BT = bluetooth):

  • BT, ,
  • ,
  • BT.

, , - AudioContext. AudioContext baseLatency. DOC :

, AudioContext, AudioDestinationNode [...]

, ( ) /, AudioContext, ...

, AudioContext , baseLatency ( ):

var context = new AudioContext();
console.log(context.baseLatency);// 0.008 for example

, , , baseLatency 0.2 , .

bluetooth DISABLE:

// baseLatency on computer = 0.008
// baseLatency on iOS devices = 0.05
// baseLatency on Android devices = 0.05

bluetooth ENabled:

// baseLatency on computer = 0.008 (same)
// baseLatency on iOS devices = 0.05 (same)
// baseLatency on (some) Android devices = 0.2 (HIGHER)

, , . BT , some Androids, baseLatency 0,2, , AudioContext - , , , , , .

AudioContext, ... baseLatency , AudioContext.

, !

0

Source: https://habr.com/ru/post/1662223/


All Articles