Audio track not working through Bluetooth in Samsung S6
Asked Answered
R

1

12

I am recording audio using AudioRecord and playing using AudioTrack. I am recording Fm analog audio stream using this classes and simultaneously passing into Bluetooth router. Its successfully working with Motorola and Samsung S5. But not working with Samsung Galaxy S6.

This is the sample code how i am recording

                            audioManager.startBluetoothSco();
                            audioManager.setBluetoothScoOn(true);
                            audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);

                       //FM_SRC is the FM receiving Antenna
                        mRecorder = new AudioRecord(FM_SRC, sampleRateInHz,
                                channelConfigIn,
                                AudioFormat.ENCODING_PCM_16BIT,
                                bufferSizeInBytes);

                        mAudioTrack = new AudioTrack(AudioManager.STREAM_VOICE_CALL,
                                sampleRateInHz, channelConfigOut,
                                AudioFormat.ENCODING_PCM_16BIT,
                                bufferSizeInBytes,
                                AudioTrack.MODE_STREAM);


                                mRecorder.startRecording();
                                mAudioTrack.play();

                            byte data[] = new byte[bufferSizeInBytes];

                            //Shuffling buffers from record to track object until A2DP routing selected
                            while (mOverA2DP) {
                                // Log.e(TAG, "mOverA2DP:" + mOverA2DP);
                                mRecorder.read(data, 0, bufferSizeInBytes);
                                mAudioTrack.write(data, 0, bufferSizeInBytes);
                            }

Please help me.

Rhachis answered 4/6, 2015 at 21:36 Comment(3)
Anything in the logcat?Scanlon
In order to help others understand your issue, please post a sample of the outputs of any logs (e.g. LogCat) or something to demonstrate a minimal, complete, and verifiable example of your problem.Suckle
Thank you guys for replay, Its not giving me any errors, or any specified logs, if you guys still want i can give you logs which i have generated. I thought its related to samsung phones issue, because its not even playing audio in speaker for normal Media player, when i have plugged Headphones. If i remove Headphones then its broadcasting to Bluetooth speaker.Rhachis
K
0

Including the Android OS versions in your question might be helpful. I've encountered issues with Bluetooth in 4.4 which were are present in 4.1 or 5.0.

The specific problem I've seen is a bluetooth disconnect after a short period of time with Android 4.4. Commands from my headset to my app stopped working a couple of minutes after launching the app. It's not exactly your problem, but it might help you troubleshoot.

(I would have made this a comment but I don't have the reputation to comment yet).

Kristinkristina answered 15/6, 2015 at 15:34 Comment(2)
Yeah thanks for replay, but my problem is different here, i am getting connected to Blue tooth, but the audio is not routing to Blue tooth speaker.Rhachis
You are right, this should be a comment and not an answer. To critique or request clarification from a question's author you should leave a comment below their post. You can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post.Suckle

© 2022 - 2024 — McMap. All rights reserved.