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

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.

Related

What Does "GADDelayAppMeasurementInit" Delay?

When using Google Mobile Ads SDK and integrating User Messaging Platform SDK, Google offers to Delay App Measurement.
You can do this programmatically or by adding GADDelayAppMeasurementInit to the info.plist and setting the Bool to YES.
It states:
Google Mobile Ads SDK initializes app measurement and begins sending
user-level event data to Google immediately when the app starts. ...
However, if your app requires user consent before these events can be
sent, you can delay app measurement...
But what does it actually do? What metrics are delayed? Does this affect whether personalised or non-personalised ads are served after providing consent?
There doesn't appear to be any more information on this anywhere.
Thank you.

Is Agora.io able to listen in the background?

Assuming I integrate Agora in my website (PC + mobile hybrid app that wraps a mobile-web site).
Will it be able to listen for users joining a channel while the client is not browsing the website?
Meaning, can it work inside a service worker on both PC and mobile?
I need a reliable way to have voice calls between users on my web application even when they are not using the website.
If you create a WebView or just open an iframe of the website then the user's video is turned off when the app is closed even if the microphone permissions are off.
The user is still on call and can track people joining but as soon as you close the browser, your video stream disappears for the other users.
To have background based workflow, I recommend you use the native SDKs for the app as well as desktop applications and implement them with the same App Id to maintain consistency.
An alternative solution is to use the RTM SDK as the RTM SDK allows you to send messages even in the background if the user is logged in and has joined the channel.

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

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.

Spotify Web API to control playback on connect devices

Is there any way to use an API to control playback on my registered spotify connect devices? I'm not trying to create or add a new connect devices but control playback to them.
Is there any official or reverse engineering discussion on how to do this?
As far as I can tell, there is no way to do this currently.
That said, it's also unclear if or when this feature will be added. Spotify hasn't updated its api code in months. It also appears that the login functionality is broken on my app too. Spotify doesn't seem to be easy to work with.

Develop application with libspotify

Now I want to develop an application on ARM with libspotify to play music.So I buy a premium account on spotify to get the API key.My original idea is that anyone who has my equipment could enjoy the music served by spotify,but the spotify does not allow to play the same song by the same account on different equipment at the same time.And even the user has their own account,they can not login from the application developed by my API key.How can I resolve the contradiction
As per Spotify's Docs, users must have premium accounts to use that functionality.
Login
To access Spotify functionality the user will need log in using Spotify or Facebook credentials. The logged in account needs to be a PREMIUM one. Note that in the Spotify login flow can be shown when the user e.g. tries to play music, it doesn’t need to come when launching the app. When logging in the user will need to accept our terms of service: spotify.com/legal.