Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avahi, shutdown and volume control #2

Open
ghost opened this issue Nov 11, 2016 · 5 comments
Open

Avahi, shutdown and volume control #2

ghost opened this issue Nov 11, 2016 · 5 comments

Comments

@ghost
Copy link

ghost commented Nov 11, 2016

First of all: THANK YOU SO MUCH for sharing this! Up and running on a Raspbian Pi 3 B, one of four cores is busy with < 30 % in average. Running quite stable with 3 target devices.

There are 3 issues left for me:

  1. On startup I get some Warnings:

# node-airplayhub --config=/opt/node-airplayhub/config.json

*** WARNING *** The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs
*** WARNING *** The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister

Do you get the same Warnings? Something to worry about...?

  1. When Music is stopped for some while I cannot restart playback. I did not measure, if this happens after the very exact time. This problem seems to be on the node_airtunes side, since the playback on the iOS device works (song is "running" on iPhone), but there is no output on any target device. Did you notice similar things?

  2. I would like to programm a GUI for the Raspi with following major functions:

  • restart the server process
  • rescan for airplay devices (Port 5000) and set it to "remember"
  • de/activate single target devices
  • adjust volume of all target devices
  • adjust volume of single target devices
    By now there is no change on the target device's volume, if I change the iOS volume. Do you have any hint about...
    => where to catch the actual volume of the input stream (in order to adjust the output volume level)
    => how to modify the volume of the single output streams (I cannot remember for sure, if this worked at any point, anyhow, changig the "volume" or "enabled" values in the config file /opt/node-airplayhub/config.json does not affect the current playback. Changing these values on the webinterface (Port 8089) does affect the playback. Is there a safe way to interact with these values by a 2nd GUI in parallel?

Thank you!

@noelhibbard
Copy link
Owner

1: These warnings are coming from nodetunes. It makes use of some depreciated API when advertizing the server. This is nothing to worry about.

2: When hitting play on your phone is has to buffer to nodetunes and then notetunes pipes the stream to node_airtunes which then has to buffer the stream to the final AirPlay destination. So you get double the lag you would get when steaming directly to an AirPlay target. The playback on the iDevice starts as soon as it is done buffering to nodetunes but you will not hear the output until if finishes buffering to the final destination. There isn't much that can be done about this.

3: Custom GUI

  • restart the server process: I can add a URL that will instruct the service to restart. Why do you need to restart the service though? Are you simply looking for a way to reload the config? If so I could add a URL which forces a config reload.
  • rescan for airplay devices: I assume you are looking for a why to auto discover airplay devices and then add them to the config file and then force a reload of the config file. I originally wrote this service for my own use only and in my setup I have several AirPlay targets that I didn't want listed so I decided to be lazy and just hardcode the endpoint I wanted in the config file manually.
  • de/activate single zone:
    call these URLs to activate/deactivate a target
    /startzone/[targetname]
    /stopzone/[targetname]
  • adjust vol of all targets: I don't have this functionality right now but would like to add it.
  • adjust vol of single target: Call this URL: /setvol/[targetname]/[volume level]

Currently I am ignoring the volume events coming from the iDevice. At some point I was going to trap these events and use the iDevice volume as a global volume. I will start working on this soon.

@ghost
Copy link
Author

ghost commented Nov 14, 2016

Great. Using URLs to control the things seems to be the best, since this way it can be implemented by a website, a client GUI program or an iOS app. I will do a deep-dive next days and get back to it.

Adjusting the volume is tricky:
=> Sometimes you want to modify all devices by absolute value steps (vol of A = 20%->25%, vol of B 30%->35%), sometimes by linear scaling (vol of A = 20%->30%, vol of B 30%->45%), since the volume scaling behavior of each device is different....
=> Also it would be nice to have a linking between the iOS volume control and the nodetunes volume control, so changing the nodetunes volume results in a change of the iOS volume. I have no idea if this is possible, but i noticed this behaviour on my AV-receiver.

I found another bug in ALACEncoder of node_airtunes and posted it here:

openairplay/node_airtunes#22

@jdtsmith
Copy link

Just wanted to add my thanks for this excellent hub, and echo an interest in having the master AirPlay volume act as a global volume control for all zones. I'm also considering a small homebridge plugin to map individual zones to HomeKit sliders (pretending each zone is a light bulb, ala https://www.npmjs.com/package/homebridge-marantz-volume). Any pointers on listing the zones the hub has found and their current volume levels, and controlling individual zone volumes from another node process? Perhaps via the web server? In my case both node processes (homebridge and node-airplayhub) run on the same device, but that might not always be the case.

@noelhibbard
Copy link
Owner

That is a great idea. The project already has some endpoints to handle volume control. The URL looks like this:

/setvol/:zonename/:volume

So '/setvol/bathroom/100' would give you full volume in the bathroom.

I am using home-bridge to control my garage door and TVs around the house. I never thought about presenting my AirPlay zones as dimmers.

When I get a chance I will work on a global volume control.

@jdtsmith
Copy link

jdtsmith commented May 2, 2017

Cool. I've looked into it and am getting bogged down in the (total lack of) homebridge plugin docs. I think the right approach is to make this a new-style dynamic platform, that discovers (via /zones) all the active zones and creates a lightbulb accessory for each of them. Question: does airplayhub auto discover new zones as they appear, or notice that zones that have gone offline? Or is zone discovery a one time thing? Also, noticed you have a hidden capability. Is there an interface for temporarily hiding a zone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants