Code Monkey home page Code Monkey logo

Comments (6)

arkq avatar arkq commented on June 11, 2024

I've fixed nasty bug which has caused infinite read loop (100% CPU). And right now the bluealsa-aplay will terminate when the phone has been disconnected.

HOWEVER, this fix does not resolve your problem completely. Right now, I'm not able to detect whether the phone has been disconnected unless streaming has occurred.

connect phone -> start bluealsa-aplay -> disconnect phone (without playing audio) -> bluealsa-aplay is still running

This disconnection "feature" will be possible in the future, alongside with the "real bluetooth speaker" functionality (accepting any MAC address).

from bluez-alsa.

George-ou812 avatar George-ou812 commented on June 11, 2024

Looking forward to this "This disconnection "feature" will be possible in the future, alongside with the "real bluetooth speaker" functionality (accepting any MAC address)."
Is the other fix in the git now?
Been monitoring the DBus signals but they only give me "connected, active and idle", not much use for using them as triggers for other things. Strangely last night I could see a org.bluez.MediaPlayer1 bus, its signals gave me "playing, paused", everything. They changed immediately with the music off the iphone as well. Very useful, but that DBus interface has disappeared ( bluealsa-aplay still plays O.K) so not sure what happened.

from bluez-alsa.

infirit avatar infirit commented on June 11, 2024

Been monitoring the DBus signals but they only give me "connected, active and idle", not much use for using them as triggers for other things

Use PropertiesChanged signal on org.bluez.Device1 and look for the Connected property. On disconnect clean up, stop stream etc.

trangely last night I could see a org.bluez.MediaPlayer1 bus, its signals gave me "playing, paused", everything.

The org.bluez.MediaPlayer1 interface is created on successful device connection when all the prerequisites like bluealsa and device support (some phone don't support it) are in place.

edit: very simple python script below to handle connect and disconnect.

from gi.repository import Gio, GLib


def on_properties_changed(proxy, changed, invalidated):
    changed_properties = changed.unpack()
    if "Connected" in changed_properties:
        if changed_properties["Connected"]:
            print("Configure and start my program")
        else:
            print("Kill my program and cleanup")


proxy = Gio.DBusProxy.new_for_bus_sync(
    Gio.BusType.SYSTEM,
    Gio.DBusProxyFlags.NONE,
    None,
    "org.bluez",
    "/org/bluez/hci0/dev_CC_61_E5_1A_39_B5",
    "org.bluez.Device1",
    None)


proxy.connect("g-properties-changed", on_properties_changed)

loop = GLib.MainLoop()
loop.run()

from bluez-alsa.

George-ou812 avatar George-ou812 commented on June 11, 2024

OK, based on Arkq's comment "This disconnection "feature" will be possible in the future, alongside with the "real bluetooth speaker" functionality (accepting any MAC address).", ultimately the "real bluetooth speaker" is actually what I'm after and trying to do. Based on that I'll wait this #issue is closed for me.
Thanks for your help.
Cheers.

from bluez-alsa.

arkq avatar arkq commented on June 11, 2024

@George-ou812 Bare in mind, that the "future" means few months (not days). This project is not a "Bluetooth speaker", but more likely pulseaudio alternative for Bluetooth Audio on Linux. Hence, this feature has very low priority for me. After all, it is possible to accomplish it already with a little bit of scripting (e.g. Python code provide by @infirit).

from bluez-alsa.

George-ou812 avatar George-ou812 commented on June 11, 2024

@arkq, appreciate your timescale's, "pulseaudio alternative for Bluetooth Audio on Linux" is perfect for me, pa is taking up far too much resources on my board just for BT. Look forward to see this sometime, keep up the good work!

from bluez-alsa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.