This Swift/SwiftUI (MacOS) demo uses unsupported (i.e. unofficial) Sonos API requests to access Sonos devices on the local network.
This demo:
- Retrieves all Sonos devices on the local network.
- Displays the groups (consisting of Sonos speakers/devices) in the local household.
- Displays the media image for the selected group with various details (e.g. track title, track length, etc.)
- Subscribes to Sonos events (e.g. volume change, etc.)
-
Before building/running this application, the Sonos API package needs to be installed: https://github.com/denisblondeau/SonosAPI
-
In SonosModel.swift, you need to set the callback URL. The callback URL is used by the Sonos coordinator to notify this demo of specific events.
private var callbackURL = URL(string: "URL:PORT")
Once you have launched this application:
1) Select a Sonos group in the demo.
2) Launch the Sonos application on your mobile device and select the same group that you selected in the demo.
3) Changing the volume in the Sonos application on your mobile device will automatically adjust the volume in the demo application.
Distributed under the MIT License. See LICENSE.txt for more information.