Closed nano9g closed 1 year ago
I've tried on my ATV which is A1842, so 4K 1st gen and could pair and play multiple time. I'm using the Windows version of SpotRaop
My ATV 4K is A2169 (2nd Gen).
Do you need me to test running SpotRaop on other platforms?
If by chance you have a Windows machine as well it could be useful
I just tested with a Windows 11 VM and got the exact same behavior. I don't think this is related, but the initial playback attempt aborted for some reason. I've demarcated all three playback sessions in the log.
Let me know if you'd like me to test anything else!
: write POST /pair-verify RTSP/1.0
Content-Type: application/octet-stream
Content-Length: 68
CSeq: 2
User-Agent: iTunes/7.6.2 (Windows; N;)
Client-Instance: bf41edbecfe380cd
DACP-ID: 1A2B3D4EA1B2C3D4
Active-Remote: 719455936
[19:37:00.000] exec_request:640 [07B62BB8]: <------ : 200: request ok
[19:37:00.015] exec_request:650 [07B62BB8]: <------ : Date: Sun, 06 Aug 2023 23:37:00 GMT
[19:37:00.015] exec_request:650 [07B62BB8]: <------ : Content-Length: 0
[19:37:00.015] exec_request:650 [07B62BB8]: <------ : Content-Type: application/octet-stream
[19:37:00.015] exec_request:650 [07B62BB8]: <------ : Server: AirTunes/695.5.1
[19:37:00.015] exec_request:650 [07B62BB8]: <------ : CSeq: 2
[19:37:00.015] exec_request:614 [07B62BB8]: ----> : write ANNOUNCE rtsp://[Main Network IP]/0002115686 RTSP/1.0
Content-Type: application/sdp
Content-Length: 178
CSeq: 3
User-Agent: iTunes/7.6.2 (Windows; N;)
Client-Instance: bf41edbecfe380cd
DACP-ID: 1A2B3D4EA1B2C3D4
Active-Remote: 719455936
v=0
o=iTunes 0002115686 0 IN IP4 [Main Network IP]
s=iTunes
c=IN IP4 [Main Network IP]
t=0 0
m=audio 0 RTP/AVP 96
a=rtpmap:96 AppleLossless
a=fmtp:96 352 0 16 40 10 14 2 255 0 0 44100
[19:37:00.079] exec_request:640 [07B62BB8]: <------ : 200: request ok
[19:37:00.079] exec_request:650 [07B62BB8]: <------ : Date: Sun, 06 Aug 2023 23:37:00 GMT
[19:37:00.079] exec_request:650 [07B62BB8]: <------ : Content-Length: 0
[19:37:00.079] exec_request:650 [07B62BB8]: <------ : Server: AirTunes/695.5.1
[19:37:00.079] exec_request:650 [07B62BB8]: <------ : CSeq: 3
[19:37:00.079] exec_request:614 [07B62BB8]: ----> : write SETUP rtsp://[Main Network IP]/0002115686 RTSP/1.0
Transport: RTP/AVP/UDP;unicast;interleaved=0-1;mode=record;control_port=55248;timing_port=55247
CSeq: 4
User-Agent: iTunes/7.6.2 (Windows; N;)
Client-Instance: bf41edbecfe380cd
DACP-ID: 1A2B3D4EA1B2C3D4
Active-Remote: 719455936
[19:37:00.093] _rtp_timing_thread:1296 [07B5F860]: NTP remote port: 52908
[19:37:00.093] _rtp_timing_thread:1329 [07B5F860]: NTP sync: 2659925532.402992486 (ref 2208988800.814133062)
[19:37:00.093] _rtp_timing_thread:1329 [07B5F860]: NTP sync: 2659925532.402992486 (ref 2659925532.420826044)
[19:37:00.110] _rtp_timing_thread:1329 [07B5F860]: NTP sync: 2659925532.475775002 (ref 2659925532.447538057)
I TrackQueue.cpp:301: Received CDN URL, https://audio-fa.scdn.co/audio/12bad368491a23ddf9d94910da934112314d193a?1691451420_SZ38SuvDpv2AFnAFRslhlbRVonOg2odfZNyP9shu56Y=
[19:37:00.156] exec_request:640 [07B62BB8]: <------ : 200: request ok
[19:37:00.156] exec_request:650 [07B62BB8]: <------ : Date: Sun, 06 Aug 2023 23:37:00 GMT
[19:37:00.156] exec_request:650 [07B62BB8]: <------ : Content-Length: 0
[19:37:00.156] exec_request:650 [07B62BB8]: <------ : Transport: RTP/AVP/UDP;unicast;mode=record;server_port=54742;control_port=50321;timing_port=0
[19:37:00.156] exec_request:650 [07B62BB8]: <------ : Session: 1
[19:37:00.156] exec_request:650 [07B62BB8]: <------ : Audio-Jack-Status: connected
[19:37:00.156] exec_request:650 [07B62BB8]: <------ : Server: AirTunes/695.5.1
[19:37:00.156] exec_request:650 [07B62BB8]: <------ : CSeq: 4
[19:37:00.156] rtspcl_setup:239 [07B62BB8]: <------ : session:1
[19:37:00.156] raopcl_analyse_setup:943 [07B5F860]: missing timing port, will get it later
[19:37:00.156] raopcl_connect:1058 [07B5F860]:opened audio socket l:55249 r:54742
[19:37:00.156] raopcl_connect:1059 [07B5F860]:opened timing socket l:55247 r:0
[19:37:00.156] raopcl_connect:1060 [07B5F860]:opened control socket l:55248 r:50321
[19:37:00.156] exec_request:614 [07B62BB8]: ----> : write RECORD rtsp://[Main Network IP]/0002115686 RTSP/1.0
Range: npt=0-
RTP-Info: seq=6335;rtptime=2864147044
CSeq: 5
User-Agent: iTunes/7.6.2 (Windows; N;)
Client-Instance: bf41edbecfe380cd
DACP-ID: 1A2B3D4EA1B2C3D4
Active-Remote: 719455936
Session: 1
[19:37:00.156] exec_request:640 [07B62BB8]: <------ : 200: request ok
[19:37:00.156] exec_request:650 [07B62BB8]: <------ : Date: Sun, 06 Aug 2023 23:37:00 GMT
[19:37:00.171] exec_request:650 [07B62BB8]: <------ : Content-Length: 0
[19:37:00.171] exec_request:650 [07B62BB8]: <------ : Audio-Latency: 3579
[19:37:00.171] exec_request:650 [07B62BB8]: <------ : Server: AirTunes/695.5.1
[19:37:00.171] exec_request:650 [07B62BB8]: <------ : CSeq: 5
[19:37:00.171] raopcl_connect:1080 [07B5F860]: setting volume as part of connect -30.00
[19:37:00.171] exec_request:614 [07B62BB8]: ----> : write SET_PARAMETER rtsp://[Main Network IP]/0002115686 RTSP/1.0
Content-Type: text/parameters
Content-Length: 20
CSeq: 6
User-Agent: iTunes/7.6.2 (Windows; N;)
Client-Instance: bf41edbecfe380cd
DACP-ID: 1A2B3D4EA1B2C3D4
Active-Remote: 719455936
Session: 1
volume: -30.000000
[19:37:00.171] exec_request:640 [07B62BB8]: <------ : 200: request ok
[19:37:00.171] exec_request:650 [07B62BB8]: <------ : Date: Sun, 06 Aug 2023 23:37:00 GMT
[19:37:00.171] exec_request:650 [07B62BB8]: <------ : Content-Length: 0
[19:37:00.171] exec_request:650 [07B62BB8]: <------ : Server: AirTunes/695.5.1
[19:37:00.171] exec_request:650 [07B62BB8]: <------ : CSeq: 6
D MercurySession.cpp:252: Executing Mercury Request, type SEND
[19:37:00.171] shadowRequest:223 [00A800C0]: spotify PLAY request
D MercurySession.cpp:252: Executing Mercury Request, type GET
I MercurySession.cpp:42: Received packet, command: 178
D MercurySession.cpp:174: Received mercury packet
I TrackQueue.cpp:158: Track name: Synesthesia
I TrackQueue.cpp:159: Track duration: 268541
D TrackQueue.cpp:162: trackInfo.restriction.size() = 1
D TrackQueue.cpp:212: File format: 2
D TrackQueue.cpp:212: File format: 1
D TrackQueue.cpp:212: File format: 0
I MercurySession.cpp:42: Received packet, command: 178
D MercurySession.cpp:174: Received mercury packet
I MercurySession.cpp:42: Received packet, command: 13
I TrackQueue.cpp:252: Got audio key
I TrackQueue.cpp:275: Received access key, fetching CDN URL...
I TrackPlayer.cpp:200: Playing
I spotify.cpp:133: trackUniqueId update => 45155e5a08607368c80357694d6da9d595b9d4d6
[19:37:00.750] raopcl_accept_frames:416 [07B5F860]: begining to stream hts:0 n:2659925532.3221401565
[19:37:00.750] _raopcl_send_sync:1254 [07B5F860]: sync ntp:2659925532.3221291008 (ts:117302715994276)
[19:37:00.750] raopcl_accept_frames:424 [07B5F860]: restarting w/o pause n:2659925532.3221401565, hts:117302715994276
[19:37:01.174] _raopcl_send_sync:1254 [07B5F860]: sync ntp:2659925533.537591808 (ts:117302716010820)
I TrackQueue.cpp:301: Received CDN URL, https://audio-fa.scdn.co/audio/3a743fc0ca3aab69ffa5e3a6d4f5c4b0dc85f6c4?1691451421_vxjdPJs-n2-dqAxl48Qqt0w1ptcmMn-uW5Nv7fwtOa8=
D MercurySession.cpp:252: Executing Mercury Request, type SEND
I spotify.cpp:249: Got next track id 7bcc02362ac34f848765d115702813a6 =>
Do you see the same issue with the other ATVs? I can't reproduce on my A1842 and A1625
I'll test it out and let you know.
I'm seeing the same issue on my A1625 with tvOS 16.6 (all my ATVs are on 16.6). I wonder what is different between our setups that it's so consistent for me.
Just to be sure: volume setting can be missed sometimes from Spotify and although the UI says it's mid-level in fact it's muted, have you tried to change it after the connection has been made
I will try that, but I'm doubtful it will help because when it's in this state, the Now Playing widget in the Apple TV Control Center shows "Not Playing" instead of displaying the track information.
I just tested and you were right - it is playing, but the volume is at zero and needs to be increased. So that was a good catch!
I still think something isn't quite right though, since the first SpotRaop session with the ATV has metadata but subsequent ones don't.
I still think something isn't quite right though, since the first SpotRaop session with the ATV has metadata but subsequent ones don't.
Yes you're right. I've totally missed that up to now and it seems to be something in my core library. First session works but artwork is one track behind. Then the ATV seems to be in a state where is plays audio but does "realize" it, nor does it display any metadata
I really can't figure out what's happening there. I've even taken Wireshark logs and all are the same/similar to what iTunes does, So I have no idea...
I've changed timing of the artwork/metadata as it seems to bother ATV when the timestamps are too close to the present. It seems to work better on my ATVs. If artwork is desync or not displayed, it corrects after ~15 sec.
I wish I could say that helped, but unfortunately the behavior remains the same for me. Just like before, the ATV displays metadata during the first post-ATV-reboot SpotRaop session, but every subsequent session the audio plays without metadata (often starting at zero volume). No matter how long I wait, no metadata appears.
Is there anything I can do to help troubleshoot further?
Well, I tried something I should have done in a long while: using the Spotify app from my iPhone to AirPlay directly to my ATV and the result is ... almost the same. Very often (but not all the time, it's true) the metadata is not refreshed after a disconnect/reconnect and stay stuck to either nothing or the last artwork and not title, album... It seems that there is more than my mistakes here, probably the continuation of Apple not caring much about AirPlay
That's fascinating, because AirPlaying Spotify to my ATV from my iPhone shows metadata every time. I can disconnect and reconnect any number of times and it's rock solid.
I had been thinking the problem could be related to AirPlay 1 from SpotRaop versus AirPlay 2 from Apple devices, but if you're having a similar issue with AirPlay 2 then I'm at a loss.
Yep ... disheartening
In fact I double checked and also metadata fails sometimes from my iPhone, it mostly works you're right. I just had a couple of "bad luck" cases to start with. Now, I looked into it again because of your AP1 vs AP2 comment and this is the issue. iTunes for Windows still uses AP1 and here the problem happens very often as well. So it is probably an AP1 issue where Apple does not care anymore about it and maybe even cripples it to force people to upgrade ... nice but not unexpected.
BTW, when I mean cripples it, I don't mean that a developer has the task assigned to make it fail, there are more subtle that companies use like outsourcing an "update" or a "rewrite" to the cheapest and least experienced offshore house. And you get what you want with plausible deniability.
Anyway, I'm afraid that regardless, its going to be difficult to fix.
Great! I’ll reopen if I see it again.
While testing the Apple TV 4K for the pause issue (#15), I discovered that the AirPlay part of the Apple TV connection works one time and will not play again until the Apple TV is restarted. I can reproduce this 100% of the time by doing the following:
The log will seem to indicate that audio is playing normally (no errors I can see), but audio never starts playing on the Apple TV and the widget in Control Center shows "Not Playing".
When things are in this state, restarting SpotConnect doesn't help; the only resolution I've found is to restart the Apple TV. AirPlaying audio from other devices (Mac, iPhone) still works fine without the restart.
Just in case I'm missing something, here are the debug logs for a successful and unsuccessful session.
Successful (audio plays on Apple TV)
```none I spotify.cpp:381: Spotify client connected for Den Apple TV D Session.cpp:63: Connecting with APUnsuccessful (SpotConnect seems to think audio is playing, but it Apple TV disagrees)
```none I spotify.cpp:381: Spotify client connected for Den Apple TV D Session.cpp:63: Connecting with AP