How to obtain list of Music Sources from the Sonos household? - sonos

I am trying to get a list of music services to which the Sonos household has a subscription. Is it possible to obtain such information from HTTP API or from any other source? If yes, then under what conditions?
I have analyzed the traffic between the Sonos Connect and Windows Sonos Controller. I discover, that information about music services is transmitted from Connect to Controller inside the ThirdPartyMediaServersX tag of the NOTIFY HTTP request. But this content is encoded in the base64-like cipher.
<e:propertyset xmlns:e="urn:schemas-upnp-org:event-1-0">
<e:property>
<ThirdPartyMediaServersX>
2:oZoYgaU5pqEq6IauQ1hYVS0oCUJnqbCkJL1vXP/DoeijejEwUBQT8UG0CksUG9VcarvLhCyElhKTUjfhQt0SAcV2oBOyLJ5BCmjd7TcJfPrVuTGHczd5/AS2tgj85n0U9yU9EwwHROFb5uV09syZNLVaZuJnENCWRKatIq1SNMm1SE4tHneLG6ULQoDOR50nf7TwyRQbkit8Bvy+kZyNPlrgBZFGmizoRmYjW8COFvHJpZhREEGruhQ2J6A8gnQOWyFzstAyHNZeLqp2xcNGnts6f2DQ56r/ducstbibFH0SZOZC0XM/BB4DvOT8UalezPL0R9/s8Jibm5T6mS1FWk14GWg2RMmRBIVE5G/gG2c=
</ThirdPartyMediaServersX>
</e:property>
</e:propertyset>
I expect to obtain list of music services, but the actual list were hidden.

As you figured out, Sonos disabled this functionality some time ago.
I've spend a lot of time figuring out how it works, and I now have a "work-a-round". External music services describes what to do.
And sonos-ts has support for external music services. If you read my first link and check the code in this library you should probably be able to figure out how to do that in your programming language.
I know this is no access to the list that is kept by Sonos, but this work-a-round also saves the tokens on the device for every client application to use.
Recently I've found someone who build an music service emulator. So that are both sides of external music services.

This is not supported by the Sonos API.

Related

CustomSD service not able to play tracks

I’m currently developing a music service and testing it via customsd. The integration in the controller app is working (iOS App & Windows Desktop App) - so I can browse - but I can’t get a Player to play any track. I keep receiving ‘unable to connect’ errors once I hit the ‘Play’ button in the controller. I can see on the service side that the Player sends a getMetadata and a getMediaURI request, and the SOAP responses delivered by the service are identical to working examples from another source; however, the Player seems unable to process them. I am kind of stuck, and I guess what would help me are the Player logs. Is there any way to get them?
Or, does anyone have any other idea about the root cause of the issue?
EDIT: More or less accidentally, I came across the reason of my problem. Whereas in general, Sonos can handle arbitrary IDs, getMediaURI only seems to work when it requests the URI for an ID of the form track:something. I don‘t remember seeing this as a requirement on the developer pages.
Anyway, got it working now.
If you're getting a getMediaURI request and responding to it with a valid response, then most likely the player is failing to process the media file itself. Are you seeing the media file being downloaded? You could host the media file locally and include the URI to that in the getMediaURI response to check.
Note that the <mimeType> included in the metadata is used to inform the player of the type of media the URI in the getMediaURL response points to.
So if you were to return <mimeType>audio/ogg</mimeType> for track123, but getMediaURI's response contained the URI https://something.xyz/track123.mp3, playback would likely fail due to the mismatch.
Have you seen bonob? Someone made a music service emulator for navidrome (self-hosted music library, a la spotify). It should be a great resource to get you started.
He wrote that your music service has to be available at https for it to even start functioning.
Note, I'm the developer of sonos-ts a library to control sonos speakers from typescript and node. And the external music services are documented here

Sonos - How to play a Spotify/AppleMusic track on a Sonos device from my iOS app?

I'm integrating the Sonos Control API into an iOS app. In our app:
the user is signed in either to Apple Music or Spotify via an Apple Music subscription or a Spotify premium account.
the user can play Apple Music and Spotify content within our app (we have the track / album IDs and use this to play music via the Spotiy / Apple Music APIs).
the user also has the Sonos app installed, and is logged in to their music service of choice (Spotify or Apple Music).
Now when the user is listening to a track in our app, we'd like the user to be able to listen to it via their Sonos device. Our app is for children and has parental control, so the user needs to stay within in our app.
Is there currently any way to achieve this?
Options we've looked into:
Streaming: As I understand it, there is no way to stream audio to a Sonos device. The AirPlay-Sonos compatibility is not an option as we're targeting all Sonos devices.
Sonos Control API: We then looked into starting the track using the Spotify or Apple Music track ID via the Sonos Control API, but this answer seems to imply that this is not possible. Is this true even if the user is logged in to the Spotify / Apple Music service both in our app and in the Sonos app? For example I could imagine using createSession with a Spotify / Apple Music accountID so that I would have access to these services, and then using loadCloudQueue to load the trackIDs. But I could be misunderstanding the API.
sonos-objc: This looked promising, but is very outdated and we haven't managed to set it up.
Any leads on this would be greatly appreciated.
Thanks!
You are correct, streaming tracks directly to Sonos is not currently supported in our platform. Using music object ids, with their constituent content and account ids, is a vehicle for actual content partners to build direct control integrations with Sonos. iHeart, Pandora, and Tidal have done this for instance.
The reason non-content owners can't utilize this functionality is due to the way authentication is handled. To ensure rights-holders property remains intact, we require partners to execute an account matching flow. This account matching requires direct access to a content partners' auth back end, pretty much limiting these types on integrations to the content partners themselves.
We understand that non-content partners want to put content directly on Sonos, and we're actively looking for the best ways to do that, while still allowing content parters to maintain control of how their content is consumed.

How do you detect changes in a user's Spotify playlist?

Scenario: Spotify user on the native desktop application is adding and removing songs from the currently playing playlist.
I'm curious if it's possible for me to detect when any addition/removal happens? Basically need a trigger to tell me the playlist has changed without having to continuously poll Spotify's API to see if anything changed. Looking for a solution that could be used either via the Spotify API or something hack-ish using spotilocal or listening on Spotify's 4070 port.
Looking for a solution that could be used either via the Spotify API
or something hack-ish using spotilocal or listening on Spotify's 4070
port.
I wouldn't recommend this approach since the mentioned APIs may change without notice. It's not publicly supported so there's no commitment from Spotify to avoid breaking changes. It also requires the user to have the Spotify desktop application installed.
As you've noticed, since there's currently no way to subscribe to changes in a playlist, e.g. by a Websocket or HTTP PubSub interface like PubSubHubbub, your application would be forced to poll for changes. If you go down this path, I strongly recommend that you make use of the ETags and snapshot_id provided in the Playlist response.
Declaring how ETags are implemented in the Web API deserves a longer response and should be on the developer site. There's however a useful Working With Playlists guide on there that explains snapshots and some other things related to playlists.
It's also worth mentioning that all applications are rate limited, so I urge anyone polling to be aware of this and poll less rather than more. Obviously only poll when the application is actively used by the user, and only poll the playlist if it's actively viewed. You know you're being rate limited if you retrieve a 429 Too Many Requests response.

What can we do with UCWA API (Lync)? and What can we not do with UCWA API?

Please explain what are features available in UCWA API (Lync)? I'm interested in the following:
Screen Sharing?
Video Chatting?
Voice Chatting?
Send a file?
I want to access UCWA API in android code, is it possible?
As per the About link of UCWA, API helps you to do the following things,
-Anonymous Web Chat.
-Support audio conferencing
-Light up IM & Presence in your Line-Of-Business app, including Windows 8, iPad, and others
-Inline Instant Messaging into your application (Contextual Communications)
-Search for Skype and/or business contacts
-Better together with UCMA Customer Care family of apps
Also you can refer this site UCWA Capabilities
A good wealth of information surrounding UCWA is available at http://ucwa.lync.com paying specific attention to the Documentation menu. A good rundown of features can be found at Core-Features which do not currently (CU3+) include screen sharing, video, voice, data collaboration (sending a file).
It is possible to place a audio call using a feature named Call-Via-Work which requires the user provide a callback number that Lync will use to connect you with the remote party, but it is not exactly the same as an audio call between two parties.
I want to access UCWA API in android code, is it possible?
There are sample libraries available (UCWA Helper Libraries) in JavaScript, but it is quite possible to use the libraries to construct code to run on an Android platform (Java, etc).

Spotify API Downloading ALL songs locally

We are looking to develop a web application which would allow users to play songs via Spotify API by tweeting in their song choices.
Since the internet connection can not be relied upon, in order to do this, we are hoping to cache ALL the track information locally and only connecting when songs need playing.
Now, how feasible would this be if we were to do this via the API or can we somehow have a single data dump?
we are hoping to cache ALL the track information locally
This isn't really possible, since 1) there's no API to get everything in the Spotify catalogue, 2) that is a LOT of metadata - it'd be impractical to download and store it all locally, and 3) doing so would be against the Spotify API ToS anyway.
and only connecting when songs need playing
If you need to connect to the internet to play anyway, performing the API call to get track metadata shouldn't pose a problem.