[Edited 16-May-2019: Added autoconnect option.]
I recently started using a pair of Bluetooth headphones with my computer, and initially had a problem with the connection. Specifically, it was pairing properly, but defaulted to the HSP/HFP headset profile (which is suitable for making calls) rather than the A2DP profile (which is higher quality and suitable for media playback). To make matters worse, when I tried to switch to the A2DP profile using blueman, this failed and the profile remained as it was.
It took a bit of online digging to find the solution to this, which is why I’m writing up this blog post. Eventually I stumbled upon an article by Jean David, in which the author explains what to do. In my case, starting with an Ubuntu 18.04 LTS setup where I already had all the necessary bluetooth and audio packages installed, all that was necessary was to edit the BT audio configuration file:
And make sure it has the following section:
[General] Enable=Source,Sink,Media,Socket AutoConnect=true
It is also important to make sure there is nothing else in this file, as it may easily interfere with the configuration. Once the file is edited, simply restart the bluetooth service:
sudo service bluetooth restart
At this point you should be good to go, with any headset starting by default in A2DP (high fidelity) mode.