Videos won't play when bluetooth connected, ritual needed to make it work

I bought a bluetooth headphone that always works in my Android, but in my Ubuntu when I connect it and try to play any video, be it in youtube or a .mp4 opened locally, it won't play. If I disconnect the bluetooth, it plays. I discovered a ritual that needs to be done in order for the headphone to work:

I first connect the bluetooth, then I move its profile in sound settings from High Fidelity Playback to Headset Head Unit, and I click "Test Sound", play a sound an hear some noises. Then I disconnect the bluetooth and connect it again and change to High Fidelity Playback again and test the sound, now it works and I hear "front, left" when I test the sound. Then everything works fine.

Is there a way to fix it? It's very annoying to do it every time I disconnect from my PC.

UPDATE: even now that I updated to Zetsy it still have this same problem


Solution 1:

Bluetooth on Linux always has been a pain. I would suggest either doing a fresh install of Zesty, buy a new Bluetooth headset that can just be used with the Ubuntu device, and/or buy a new wired headset/phone.

Solution 2:

I have similar problems with Bluetooth.

Luckily pylover has turned the ritual into a program.

See here:

https://gist.github.com/pylover/d68be364adac5f946887b85e6ed6e7ae

This program generally works for me.

Solution 3:

Try this: I saw this somewhere, but I dont remember the source now.

hcitool dev - shows the mac of the bluetooth device You would need this to insert it later in the file below ( if not available, create it )

#/etc/bluetooth/asound.conf
pcm.btheadset {
   type plug
   slave {
       pcm {
           type bluetooth
           device xx:xx:xx:xx:xx:xx
           profile "auto"
       }
   }
   hint {
       show on
       description "BT Headset"
   }
}
ctl.btheadset {
  type bluetooth
}

Another file ( if not available, create it )

#/etc/bluetooth/audio.conf

[General]
Enable=Source,Sink,Media,Socket

This below command will fetch an user interface and many things can be done.

sudo apt-get install pavucontrol