Music is not being played through BLE connected headphone on iPhone

I have created a demo iOS app to create BLE connection with surrounding headphone.

I am able to connect to headphone successfully through my demo iOS app. I can also see in iPhone Bluetooth Setting that headphone is connected but when i am playing music from Spotify/YouTube then music is not being played through headphone. It is still using iPhone speakers.

First i am scanning sarounding bluetooth Devices through CBCentralManager and then connecting one of the found device.

cBCenteralManager.scanForPeripherals(withServices: nil, options: nil) For connecting:

cBCenteralManager.connect(peripheral, options: nil) Do i need to make any code changes while connecting via BLE?

I am expecting when i am connecting to headphone via my Demo app. Same connection is visible in iPhone Bluetooth setting too then when i play music on spotify/youtube then sound should be played on headphone and not on iPhone speakers.

Unfortunately your expectations are misplaced, and this will not work like you think it will.

Are these headphones using BLE Audio? Or are they using BT Classic for audio, but also have a BLE component that you can connect to? In most headphones, the audio will be through BT Classic. In that case you connecting to the BLE side will not do anything about the connection to the Classic side.

Also, for device audio to play through the headphones, it must be the device who connects to the audio profile. Having your app connect to the headphones will have no effect on whether the device itself connects to the audio profile and route audio through the headphones.

Also, for device audio to play through the headphones, it must be the device who connects to the audio profile.

but when i am connecting to headphone via my app using BLE. I can see the headphone is connected in iPhone Bluetooth Settings too. Headphone supports both BLE as well as Classic Bluetooth.

Music is not being played through BLE connected headphone on iPhone
 
 
Q