-
Notifications
You must be signed in to change notification settings - Fork 236
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
Stereo HomePods show as two devices and switch playback between eachother. #1291
Comments
I compiled the latest version from source and I edited the config to force two HomePods to use AirPlay2 instead. I can see they are added as AirPlay2 now but they still show as two devices. When I select both of them in the UI before playing a song they appear to be selected. Once I start playback it looks like it drops both of them and then starts playback on one of the pair. This seems to play out of the one speaker until I try and enable the second one. After that it will continue to switch back and forth between the two every couple of seconds. I uploaded a new log from the version compiled from master and my doing what I described above. |
Thanks for reporting this and sharing logs. I had a look at them, and they show that the speakers are disconnecting quickly after the playback session is started. Owntone perceives this as a connection failure and then tries to restart the session, which results in the switching back and forth that you experience. It is interesting that this also seems to happen with Airplay 1, which to my knowledge doesn't have the concept of grouped speakers. If you have a Windows PC I would like to hear if iTunes works better? I think iTunes also still only has Airplay 1. I can't offer much with regard to actually solving the issue. It seems like starting playback in this scenario needs to be done in a specific way, but since I don't even have a single Homepod I won't be able to pursue this. |
Yeah I definitely understand and I have actually been following this and Shairport-sync for some time to keep up with the progress of AirPlay2. While I love these, it's been frustrating because macOS (until BETA Monterey now finally) doesn't even list the pairs as a single destination. The only app that did was the Music app, but now in Monterey you can finally select a stereo pair as an output for all system sounds. I never messed with iTunes on Windows but I just fired it up and it also lists them as individual HomePods instead of grouping them. It actually can't even find or populate all of my AirPlay devices and most of them are missing and it changes which ones it shows every song I play lol. With Monterey finally showing them as a single target (and working) for system wide sound, do you think there is networking traffic/logs I can capture on my Macbook that may help? |
I installed Wireshark on my M1 MPB on the beta and captured logs for my selecting the stereo pair as an output and successfully playing a YouTube video, changing the volume, then pausing it by touching the HomePod. Do you think this would be useful for me to send to you? |
Hi. The latest versions of Mac OS do support HomePod stereo pairs natively outside of the music app. You do not need the beta version of Monterey. Which version of Mac OS are you running? |
I am using Monterey, I don't have anything on Big Sur and maybe I just didn't notice the short time I was on Big Sur but that is good to know. I know it was not like that on Catalina. |
I don't think so. The captures would be encrypted, and capturing in cleartext is complicated. One thing you might try is disabling ipv6 in owntone.conf, just to see if it makes a difference. |
Thanks for a reply. I tried IPv6 disabled and it seems to behave the same way it has been. I also tried out AirFoil since they support AirPlay2 now but they also show all the homepods individually so they also do not support stereo homepods. Might have to try and come up with another solution until someone figures out how to detect and send audio to them as "one" device. |
I don't think Airfoil supports Airplay 2 at least they don't advertise it that way. Airfoil supports streaming to multiple HomePods in sync but this is using AirPlay 1 the same way that Owntone does it. I would be happy to be corrected as that would be a big feature for Airfoil. |
FYI. I use a pair of Homepods in a stereo pair, actually they are also paired with an Apple TV, and I am able to use them as a stereo pair when using Airplay 2 from iOS/macOS or watching anything on my Apple TV and also when using Owntone when they are both selected as separate outputs. I do this everyday and have never experienced this issue. Is it worth trying to reset your HomePods? |
Yeah I guess they say that they support sending to AirPlay2 devices but not that they are using AirPlay2, so I think you are right. I can maybe try resetting one pair of HomePods but I get this behavior for all 4 of my stereo pairs. It could be that they are on the beta audioOS that causes them to behave differently. One of my pairs is also paired with the latest 4k AppleTV with ARC enabled and I do not have any success with that pair either. I don't have any issues using them with any Apple device to send audio, just been trying to find something to control them within Home Assistant. |
That is interesting. I would hedge my bets that it's because of the beta versions. Did this work successfully on the last production release? I am all up to date on production versions and haven't had the issue as I mentioned. It's concerning though. I hope this is fixed in the next beta if this turns out to be the root cause. |
Unfortunately the last time I tried forked-dappd was over a year ago, I know it didn't work great with them either but I cannot remember the specifics. I do not use OwnTone normally, was just taking another look again since AirPlay2 has been somewhat hacked/implemented. I'd be willing to send a pair of mini's to anyone that is willing to figure it out but not expecting anyone to do it =D. I'll see if I can make some time to completely wipe a pair and see if it makes any difference. Would be nice to at least have audio coming out of both and stop switching back and forth lol. |
I went ahead and reset one pair and then added them back into HomeKit as a stereo pair and I still have the same behavior. They are still on the beta versions since the reset does not revert the version they are on. |
If you break the stereo pair (just for testing) are you able to play to both devices simultaneously from Owntone? |
Yeah, if I break the pair then they work just fine being both selected. |
Hmmm. I'm out of ideas then. Hopefully it will be fixed in the next beta. |
Don't update to HomePod 15. I have now the same Problem... |
Yeah I have been on the developer beta so that answers my previous questions that it was because of audioOS 15. I installed it when it first came out before I tried owntone. |
Very annoyingly my HomePods have auto updated to HomePod 15 overnight and I have the same problem. I will calling Apple as I am super unhappy about this. |
@ejurgensen - is there anything we can do to try and investigate this further, even if very complicated. Unfortunately this HomePod update has completely broken my home setup and I'm very keen to try and resolve it. Thanks |
Sorry to hear about this, for starters I will reopen the issue. Just to make sure I understand: The issue here is that when two Homepods are grouped, but are selected individually in Owntone, playback is switching back and forth, right? And is it so that if only one Homepod is selected it plays normally? I think the path to solving this would be to analyze a working configuration, e.g. when an Apple device is acting as sender. Historically, iTunes has been the go-to reference sender, but I understand from @shauder that that won't work here. Is there another sender that is able to play where each HomePod is selected individually? It is not directly possible to analyze the traffic with Wireshark, since it is encrypted, but it is possible to do it by running a "proxy" that pretends to be a speaker but in fact transciphers and forwards traffic to/from the actual HomePods. So in this case traffic could be analyzed by setting up two such proxies. It is, however, pretty tricky, because the proxy does not fully work as a HomePod. And as mentioned the basis must be a working configuration, which I at least don't have. If there are no senders that can send with speakers selected individually, but only to the group, then it is even more complicated, because the proxy is not able to act as a group. Thus it would be necessary to first figure out how groups even work, and then modify the proxy to take that role. |
@ejurgensen - thank you for your response and reopening the issue. I have done some further investigation this evening and have documented my findings below, but first here is my setup. I have two HomePods running HomePodOS 15, they are stereo paired and also paired to my Apple TV 4K (the latest one) as the default output. At present my AppleTV is running OS 14.7. Playback on the AppleTV and from an iOS device using Airplay2 seems to work perfectly. I also have a raspberry pi 3 running raspbian os and the latest version of Owntone specified from your repo. I use Owntone to play internet radio streams to both HomePods (selected as top separate output devices) as well as hosting my ripped CD collection and assessing Spotify. This had been working perfectly until the HomePods updated yesterday. The behaviour I get is as follows. When selected a new radio station and selecting both HomePods I initially get no sound and the owntone log (set to INFO debug level) shows the following outputs. Sep 24 21:21:15 music-pi owntone[13633]: [2021-09-24 21:21:15] [ INFO] airplay: Setting up AirPlay session 3241451419 (192.168.1.231 -> 192.168.1.170) Eventually however I do get audio playing consistently but only from one of the HomePods. I have done some testing this evening using iTunes for Windows 12.8 in a Windows 11 Parallels VM running on my M1 MacBook and the behaviour from iTunes is exactly the same despite selecting both HomePods on the output. This leads me to believe this is purely a HomePod OS issue as Apple have broken their own product with this update. So I guess the best option will be to raise a ticket with Apple to try and get them to look into it. Having said this, I am still willing to try and investigate this in the unlikely event that we can resolve it. In response to your questions above.
Yes, it is correct that when I select the second HomePod from the Owntone UI, the audio stream switches away from the already selected HomePod to the newly selected device. Yes, it appears to work correctly if only 1 HomePod is selected. |
I have the same problem after upgrading to 15 :( |
@ejurgensen if you by chance can provide some guidance I can probably set something up to capture what is needed if it's possible. I am in the middle of moving but this weekend I could sit down and see what I can do. If you have not seen it, there is also this with lots of AirPlay2 examples. |
@shauder - is there a link missing from your previous post? |
HI @ejurgensen, i collected the information and stripped the other devices.
Here the dump (hope I do not disclose anything sensitive):
|
Just for the sake of completeness, the following records are for two airplay2-receiver instances that show up as a stereo pair in iOS and macOS:
Playback from owntone also works fine. |
I'm a little confused. Do people have this working with 15.3? I was working on the assumption that the fix from Apple was in 15.4 whenever that maybe released. |
Your big HomePods are running 15.4. The minis are running 15.3. I believe you need 15.4 for the fix. |
Wow, good catch. When HomePod OS 15.3 was released last week, I checked that all speakers are at the same version (15.3) but now I found out that I still have a Beta Profile on the bigger ones. So you might be right. 15.4 seems to be the solution. I will verify with the small ones, too. |
I have updated the two HomePod Minis to 15.4 and this solved the problem. Playback works nicely without any toggling of the selected speakers. Once 15.4 is out, we will most likely be able to close this issue. Nevertheless, I would like to see groups/stereo pairs supported (mainly in the web ui ) but that's a different subject. |
Contributors, worth raising another issue for this? |
I am willing to devote time to develop the group support. However, I can only talk about HomePods (I have a bunch of these) and two IKEA Symfonisk Speakers that are basically Sonos speakers, that can be grouped into a stereo pair as well. I already looked into this but I would need to get some guidance form @ejurgensen regarding how the data structures should be amended to accomplish this since this could in some way also affect other signal paths that I have no way to test and that I might not even be aware of. |
@ma-ku - do you have working knowledge of how Apple implement their stereo pairs with HomePods? I appreciate they are advertised differently via mDNS however there must be other changes implemented under the covers swell. Do we know where the L-R processing is done? Does each HomePod just receive the full stream but playback only the specific channel it is assigned? Additionally, since this is an Airplay2 feature, in order to support the grouping would Owntone need to implement ptp in order to support the grouping required? |
Do these IKEA speakers support a stereo pair when using Airplay2. To my knowledge no 3rd party speakers support Airplay2 stereo pairs other than the HomePods. I believe Apple ban this. My pair of Denon Home 150s stop advertising Airplay when put into a stereo pair as an example. |
As I already mentioned; I provided a patched version of airplay2-receiver that allows to run two instances that show up as a stereo pair and can receive audio streams from iOS devices. Technically the grouping is not overly complicated. It's mainly a matter of handling the mDNS metadata correctly. The stereo pair is a grouped set of speakers like other groups (e.g. multiroom groups) but with a few special characteristics that help iOS devices to show them as one group whereas other groupings could be dissolved in the Airplay control panel of your iOS device. The magic of stereo pairs is just that each speaker knows which channel to play but all speakers receive the same stream. From a owntone perspective, it does not matter. Once you are on 15.4 with your speakers, the stereo playback works out of the box, but you have to select both speakers for output. I would still prefer some support in the UI as stereo pairs have their own name that can be different from the names of the individual speakers. |
Well, the Sonos stereo playback is handled somehow mutually by the Sonos speakers. Once they are grouped, only one device is broadcasted on mDNS and the stream would be sent to that single endpoint. I would assume that Sonos adds some addtl. buffering and handles the simultaneous playback between the peers. |
Excellent, so this is literally a UI feature really. I hope this can be implemented. I was unaware that the HomePods are playing the left, right channels correctly from OwnTone when in a stereo pair. This is very good news. |
And ultimately this also means that the same principle could be applied to streams with more than two channels to support spatial playback (e.g. Dolby) since the data is the same for all devices, they just pick the data they are 'responsible' for. |
Have you been successful in testing this? If the Sonos part is managing the stereo pair I don't see how the timing is maintained with other Airplay2 devices that may be in a group unless Sonos have a special arrangement with Apple, but I thought stereo pair support is one of the HomePod USPs. |
That's what I meant. Sonos does it their own way. Once speakers are paired, they become one speaker in the Airplay world. Regarding Airplay2; if we were implementing a playback software, then the timing and synchronization between the peers would be an issue but from a clients perspective it's just streaming to one or more Airplay speakers and they take care of the details. |
It believe so, as this is more of a new feature and is not related to this issue. There may be more rabbit holes to go down if we get a working POC for the Stereo pair support. As an example, a few observations and questions I have are:
|
Right. That's good to know. I don't have any Sonos (or IKEA) speakers. I may have opted for these instead of my Denon's had I known this. I thought the whole point of Airplay2 was audio synchronisation across multiple speakers. I must admit I am surprised that this works because surely the Sonos pairing needs a buffer to maintain a good sync and this must break the Airplay2 sync. Maybe they factor for this in their Airplay2 implementation. This is not related to this topic though. Thanks for the discussion. |
Very interesting findings, brings hope that grouped/stereo can be supported too. I'm happy to help with guidance on any implementation you want to try, @ma-ku. Your questions are very relevant @aleszczynskig, and I would add that the role of the group leader is still unclear to me. I initially thought it might be the leaders job to relay the audio stream (or load it from external sources), but I guess that is not the case. But what then? Is it acting as a volume control master, or is it the paring, or maybe related to PTP? Another question on my mind is why it took Apple so long to develop Airplay 2 if grouping/stereo is mostly presentation. I was under the impression that it was to change architechture to offload the network i/o from the phone to conserve power when there are many speakers - but maybe that wasn't it. |
The group leader information seems to be related to the ability of the device to act as a group leader. HomePods can play streams to other devices whereas other devices can only act as recipients. In a more complex group of Airplay devices (formed in the Airplay control panel of iOS), the group leaders were set only for HomePod devices even though the iPhone was the streaming source. In the Stereo Pair both HomePods are listed as leaders. For now I would not waste too much though on that. @ejurgensen: Where would we discuss the implementation details? |
@ma-ku. I tested a stereo file from Owntone on my HomePods which were stereo paired. I had no stereo separation. Both HomePods were playing the left and right channel as though they were grouped. How did you test the left/right separation? I checked the same stereo file with my AirPods and it worked correctly. |
Well, I used the following file https://www.kozco.com/tech/LRMonoPhase4.wav to test and there was clear separation on the original HomePods. And I just checked again - still clear separation. Whereas the same test on two HomePod Mini speakers does not provide stereo separation – I can confirm the observation of @aleszczynskig. When I did the test before, I was just looking at the toggling of the selected playback targets in the settings as the computer and the HomePod Minis are in two different rooms (laziness apparently does not always pay off). |
I suggest you open a new issue for that purpose. Then we can close this one, since the switching back and forth issue was thankfully solved by Apple. I think it would be good to keep the discussion here on github, that way @aleszczynskig can follow and help, and we might also need @chme's help, since he is the master of the web UI and mpd. |
Regarding metadata: comparing the mDNS records of the two stereo pairs, the following can be observed: One of the pair has flags=0x9a404 whereas the other has flags=0x98404. Bit 13 is different and according to https://openairplay.github.io/airplay-spec/status_flags.html this is ** TightSyncIsGroupLeader** apparently indicating the lead role for timing between the two peers. I collected the mDNS data for the two pairs. Here is the info for the (legacy) HomePods (Group name is "Büro 2" and left speaker is "Links" and right speaker is "Rechts"):
And here the same information for the two HomePod Minis (Group "Büroküche" with left speaker being "Links (2)" and right speaker "B__rok__che (2)"):
Another interesting finding is that we have another service involved:
This is a PTP server on one of the legacy HomePods and it is referenced through the tsid record of the "Büro 2" group. A similar record exists only for the "B__rok__che (2)" speaker. |
One update before we close the issue and move forward implementing stereo groups in the UI and the backend; I rebooted the stereo group with the HomePod Minis and gave them plenty of time to come up again before I did the test again and now the stereo feature is working nicely. The initial test was basically executed right after the stereo group was setup and eventually not everything was ready for the show. Maybe that was also the case for @aleszczynskig. Could you please try again. |
Here it is: #1413 |
I have done some testing on this but it seems I have some problems with my setup because my stereo pair does not work even from my iPhone. I do not believe the stereo pair is forming correctly so it's likely that my setup is broken. I am investigating now and will report back my findings. |
Closing, apparently fixed in Homepod OS 15.4 |
Version: 28.1
Platform: Same problems when running from my x86_64 Arch box running in docker and my Raspberry Pi4 also running in docker
I have 4 stereo pair OG HomePods and when I try and use this it discovers them all individually and it also discovers them and assigns them AirPlay1 instead of AirPlay2, which I can see it doing in the logs.
If I start music and then I select one of the HomePods in a stereo pair then it will play through the one HomePod. When I select the second one in the pair then it will start switching back and forth between the two in the pair automatically.
I unpaired them and then I was able to select both of them and stream to them, then I paired them back and I am back to the same behavior. I captured lots of debug logs with all the steps I talked about above.
owntone.log
The text was updated successfully, but these errors were encountered: