sonos | A PHP library for interacting with Sonos speakers | Speech library
kandi X-RAY | sonos Summary
kandi X-RAY | sonos Summary
A PHP library for interacting with Sonos speakers
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Discovers devices from the network .
- Adds multiple URIs to the queue .
- Restores the state of the controller .
- Send the multicast request
- Create metadata for the service
- Get frequency description .
- Returns whether the speaker is a speaker .
- Get playlists .
- Get available devices .
- Get favourite items .
sonos Key Features
sonos Examples and Code Snippets
Community Discussions
Trending Discussions on sonos
QUESTION
I followed the Sonos docs for adding app authentication and the page for using authentication tokens and the result is that the SMAPI server correctly returns an authToken together with a privateKey back to the controller. I can see the authToken being present in the credentials header inside the SOAP messages sent to my SMAPI server.
However, despite the many mentions of this inside the Sonos docs pages related to HTTP requests (I will list the resources links down below), the same authToken is not being sent inside the HTTP header Authorization, this making my CQ server unable to validate requester identity.
I tried the following, without success:
checking "Requires authorization header" capability in the customsd page of my Sonos device (I tried this because the docs page about capabilities precisely indicates that checking this "Sends OAuth token in the HTTP Authorization header.")
identifying some correlation between the "X-Sonos-" prefix HTTP headers used when the controller sends SOAP messages to my SMAPI server and the "X-Sonos-" prefix HTTP headers used when the device sends HTTP requests to my CQ server (eventually, I could not find any information that would identify the user based on this)
From Sonos device:X-Sonos-Playback-Id: RINCON_48??????D201400:3165321802 <= deviceId inserted after RINCON_
X-Sonos-Device-Id: Sonos_U????????????????????????6 <= householdId
X-Sonos-Corr-Id: 267e3e0c-75ca-4b9d-8be4-b8a795a462a3 <= unique each time
From macOS Controller:X-Sonos-Controller-ID: 68:??:??:??:??:07 <= the same each time
X-Sonos-Api-Key: 8??????e-7??7-4??f-b??6-7??????????0 <= the same each time
X-Sonos-Corr-Id: 648ec896-e043-44f8-bfba-cd0a80c9d857 <= unique each time
- checking both "Include SMAPI context headers with all requests" and "Include Zone Player IDs in credentials header" capabilities in the customsd page of my Sonos device (I tried this following the answer to this sonos tagged stackoverflow question Now that device ID is deprecated, is there another way to identify the client?)
The docs links I mentioned above that refer the presence of the auth token inside the HTTP Authorization header are the following:
the GET /context CQ API method page says to return 401 Unauthorized when "The access token has expired or is invalid."
the GET /itemWindows CQ API method page says "the player can use this API to obtain a new access token in the response from your cloud queue server" and "The request contains the access token in the authorization header" and "If the access token is set to expire soon, an updated one is included in the X-Updated-Authorization header of the response"
the POST /timePlayed CQ API method page says "The request header contains the access token in the authorization header" and that the method returns ERROR_SONOS_TOKEN_EXPIRED when "SMAPI OAuth token is expired, and user must re-authorize the account"
the GET /version CQ API method page says again that "The request contains the access token in the authorization header" and talks about a now deprecated updateToken parameter and also says that "If the access token is set to expire soon, you should include an updated token in the X-Updated-Authorization header."
But the most clear mention is in the page about HTTP requests, because it's not particular just for the CQ API endpoints but for all HTTP endpoints, even those hosted by the SMAPI server itself. The page reads the following 2 excerpts:
and
To conclude, with so many mentions of it in the official Sonos docs, why isn't this essential header being transmitted in the HTTP Authorization header? And how should a CQ verify the identity of the requester without the presence of this authToken on each API method request?
...ANSWER
Answered 2021-May-09 at 22:26If I follow you correctly, the token is passed in the header under loginToken, see https://developer.sonos.com/build/content-service-add-features/add-authentication/use-authentication-tokens/
This is not an http header, this is a section of the SOAP envelope. Like this:
QUESTION
Trying to install and utilize the https://developer.sonos.com/tools/developer-tools/sonos-simulator/
When following the install instructions and trying to install the node package via the npm install command within the directory it fails with a 404 error trying to find node-ssdp as seen from the snippet below:
...ANSWER
Answered 2021-Apr-24 at 21:43I was having a play around with this today, and managed to get it working.
I installed an old (4.x) version of node as this is what the documentation said it worked with (I honestly didn't try anything newer as I couldn't get the simulator to do what I wanted so uninstalled it after).
The main issue was with node-ssdp, as the included package file with the simulator was trying to get it from a repo that no longer exists. After some trial and error, I found that if you edit the package file to specify node-ssdp 2.7.0 (which is the version that was released when the simulator was), the npm install should go through ok. (If you install a newer version the simulator crashes a few seconds after you run it).
Hopefully this helps!
QUESTION
Good morning,
I want to query households (my first query and generally first experience with the Sonos API) and have authenticated successfully. I got an access token and query the Control API like this:
...ANSWER
Answered 2021-Jan-19 at 14:16I see two issues with the code snippet you provided:
- Issue 1: Your API URL has a typo. You used "househoulds" instead of "households".
- Issue 2: Your URL needs to use https://, not http://
If you fix those two issues and are indeed using a valid access token, your request should work.
QUESTION
I have installed composer on my Synology NAS using this tutorial. I did use PHP73 instead of PHP70 because the package I would like to install requires a minimum of PHP72. It all seems to run fine until I run the following command:
...ANSWER
Answered 2020-Dec-03 at 08:30Solved this by adding the following to my composer.json file and thus forcing composer to use a different version of PHP:
QUESTION
Turning to all you smart people out there for help, tips and trix :)
I want to connect my NodeRed instance to the Sonos API to control my speakers in various ways. During the OAUTH process however, after logging in with my username and password for my account, the auth code being sent back to me through my redirect_uri seems to be too short? In the developers' guide the example auth code looks like this: f10072fa6-2134-4fe1-93fd-ca5b9cffa738 where in my case, I just receive the first part up until the first dash sign. Eg.:f10072fa6
At first I ran the connection through a NetScaler, then I changed to using a Nginx Reverse Proxy thinking that the Netscaler might have truncated the URL (for some very odd reason), but the result turned out the same..
Ideas anyone?
...ANSWER
Answered 2020-Sep-22 at 14:04The Authorization code you received is correct. The Authorization code format was recently changed and the documentation needs to be updated to reflect this. This question was also answered in Authorization code has different structure than example code.
Thanks! -Mark
QUESTION
I'm trying to get started with SONOS programmed radio feature, but I can't seem to find their Cloud Queue server sample referenced in the docs. Namely, the docs (this link) says the following:
A cloud queue to serve the list of tracks to Sonos players. See our cloud queue sample server for a sample implementation and Play audio for details about cloud queues.
with cloud queue sample server receiving 403 File Not Found
I noticed the same thing happens in the case of another sample code of theirs, also referenced in the docs (this link) here:
For example, we handle this on our Android cloud queue sample app by moving music playback to the local device so that it continues playing on the local device and stops playing on Sonos.
with Android cloud queue sample app receiving same HTTP error.
How can I access this needed samples?
Thank you in advance
...ANSWER
Answered 2020-Oct-28 at 12:00Just received this email from developer-feedback@sonos.com
Hello,
You should find the links to these samples restored. Let us know if you encounter further issues. Disclaimer: we are not actively maintaining these samples and they are provided as-is.
Best, Sonos Sound Platform Team
I verified the links and they're working
QUESTION
I am dynamically building up some queries that look like this
...ANSWER
Answered 2020-Aug-29 at 15:23Use json_array_length
as your final out put is in JSON Array
format.
QUESTION
I'm looking at my options to control the Sonos Port at https://developer.sonos.com/reference/. I read about some UPnP control of other Sonos devices, but I can't seem to find any official information about this online. Is UPnP control of the Sonos Port possible?
...ANSWER
Answered 2020-Jul-02 at 02:01Sonos uses UPnP for some calls internally, but we never publicly supported this protocol. We encourage you to use the Control API to control Sonos devices. See Connected Home: Get Started for details. Let us know if you see anything missing that you'd like us to add.
QUESTION
I am integrating Sonos using Control API.
In the login phase, the user writes username and password in the Sonos login page and authorizes the integration. After that Sonos returns an authorization code back to my integration to use for calling api.
I would like to display the username in my application. How can you get it?
...ANSWER
Answered 2020-Jul-28 at 13:33Unfortunately, there aren't any publicly-available APIs for getting the user information you are looking for. Given the sensitivity of any type of user information, we don't have any plans to expose APIs for getting this information in the near future.
The closest thing to a user unique identifier would be a householdId. This is documented here: https://developer.sonos.com/reference/control-api/households/.
Thanks,
-Mark
QUESTION
So I'm trying to build a application following the Sonos documentation, which can control my Sonos speaker. Sending a GET request to get a authorization code works just fine, with the exception that my code looks like this "qNvyst9Y" while the example response shows following code "f10072fa6-2134-4fe1-93fd-ca5b9cffa738". So the format of my code is not the same as the example code's format.
Am I missing something or why is this?
...ANSWER
Answered 2020-Jul-21 at 19:56I can confirm that the Authorization Code you received is valid. We recently changed the format, so will update the documentation to reflect this change.
Thank you for calling this out!
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sonos
PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page