I want to stream music from my laptop with Ubuntu 18.04 to audio device (LG CM2760). I wrote short script in Python where I want to connect with my audio device and then play music. I'm not sure but think that connection is established correct because LG shows my laptops' name. Unfortunately, when I start 'streaming' there is nothing but silence. Problem may be with bytes version of song but I've done 2 days research and found nothing which could help me to solve this.
I tried to convert song to other formats.
import bluetooth
from time import sleep
uuid_to_find = "110D"
service_matches = bluetooth.find_service(uuid=uuid_to_find)
first_match = service_matches[0]
port = first_match["port"]
host = first_match["host"]
print(port)
print(host)
sock = bluetooth.BluetoothSocket(bluetooth.L2CAP)
sock.connect((host, port))
song = open("/home/adrian_chlebosz/Downloads/song.wav", 'rb')
byte_array_song = bytearray(song.read())
song.close()
max_mtu_song = list()
for i in range(0, 64000):
max_mtu_song.append(bytes(byte_array_song[(671 * i):(671 * (i +
1))]))
for i in range(0, len(max_mtu_song)):
sock.send(max_mtu_song[i])
sleep(0.5)