As advised by Memphiz from XBMC team - posting my issue here:
When I AirPlay music from iPhone to XBMC and then within XBMC start playing any other source like video/audio - the source of AirPlay continue to send audio to XBMC, but it is not playing it. When I stop playing the video/audio (that has interrupted AirPlay) - XBMC is idling, but AirPlay source is still sending audio. If I stop and start audio at source (iPhone) - nothing happens - silence. iPhone believe it is streaming audio, but XBMC is not following anymore. I have to switch AirPlay target on iPhone from XBMC to local and then back to XBMC in order to restore streaming.
If I compare with streaming to AV receiver - then when I change source on AV receiver - iPhone puts streaming on pause and switch off AV target.
I would appreciate the following behaviors instead:
XBMC send pause back to AirPlay source (iPhone/iTunes) before starting playing another video/audio and then:
1) when another video/audio is stopped - switch back to AirPlay and send pause/play signal again to restore play
2) if above not possible - then disconnect the source from XBMC, so that iPhone/iTunes is back to it's internal speakers
As per Memphiz, XBMC use shairplay library for audio streaming and it does not support sending pause or disconnect.
Can pause and disconnect features be implemented in library? Thank you
Copying from another issue:
This is a valid feature, but I'm not sure if this should be part of shairplay library itself. What shairplay could do is to pass the DACP-ID to the calling client, but I think the actual DACP part should be in a separate library or script really.
Thanks. You also suggested in the other post quote Documentation is at http://nto.github.io/AirPlay.html#audio-remotecontrol I wonder what @Memphiz has to comment on this, does Kodi support DACP in any way? quote
kodi has no support for dacp as far as i know. Just for double checking - @Montellese i guess the upnp control stuff is different right?
Upnp control is different from dacp, but dacp itself is pretty easy and small thing to do. The reason why it doesn't fit well shairplay library is that it requires doing mDNS discovery in order to get the TCP port correctly for the control, and mDNS is something I'm kind of trying to get rid of in the library.
After all kodi is not even using the mDNS functionality of shairplay lib and if we talk about kodi and dacp it would be much easier to do it on a higher level like python if possible. And my understanding is that dacp can be used for controlling even when airplay is not being used, so it's not that closely tied to it. Airplay protocol just gives an identifier of which dacp device is the same one that is sending data right now.
Doing the mdns Discovery inside kodi is not a problem - Integration of the controls should be done like a remote player i guess - so basically similar like upnp Remote renderers are integrated - question is if its worth to have a dacp lib which gets inited with id, ip and tcp port and use it to control the corresponding Player (in our case the AirTunes client)
Thanks guys, this is fantastic. Appreciate you looking into this. I just opened another feature request about showing albumart in Kodi when airplaying (http://forum.kodi.tv/showthread.php?tid=225954). Is this related? Thanks again for all your development work!!!
@juhovh for a Start i would need a way to get the id and the active-remote Header from libshairplay during Streaming for determining the correct dacp server
@Memphiz you are right, I will try to add them to the master soonish (it should be just one additional callback with no API breakage) and let you know when they're in.
@juhovh maybe something like
void audio_remote_control_id(const char *identifier, const char *active_remote_header)
Even if the identiier is an 64bit int i would prefer to have it as hex string so i can do a string compare with the bonjour announcement (at least if the DACP-ID header has a hex string in it in the rtsp request...)
I merged the pull request #37 so I guess this can be closed, should get things rolling.
Yes ... will last a while until this will be available in kodi - it needs majore intrusive changes to support controlling the airtunes client from the internal player ... just fyi for the requesters ...
teaser: https://youtu.be/cldS8Bq_3jg :)
Wow, this looks much nearer to completion than I had ever anticipated. Really cool!!!