Skip to content

Device group support #30

@defagos

Description

@defagos

As a Google Cast owner of several devices I need to be able to individually control volume/muted for paired devices.

Acceptance criteria

  • An API for listing multizone devices is available.
  • An API for controlling volume/muted for multizone devices is available.
  • Changes are not possible for devices which do not support them.
  • APIs for easy SwiftUI binding to controls are available.
  • The standard Castor device management UI displays paired devices as well as individual volume/muted controls.

Design hints

The Google Cast SDK API introduces separate GCKMultizoneDevice objects, whose volume/muted values are controlled via GCKCastSession. Multizone devices are not nested within GCKDevice objects, they are rather retrieved using a GCKCastDeviceStatusListener attached to the session once connected to a device, and lost afterwards. Note that GCKDevice and GCKMultizoneDevice are different objets, not sharing a common ancestor. They have a few similar APIs but the comparison stops here.

For this reason the following API seems reasonable:

  • CastDeviceManager, resp. CastMultizoneDeviceManager, are introduced to provide volume/muted control APIs (volume and range, muted flag). These are ObservableObjects which can be bound to UI elements.
  • Two recipes MultizoneVolumeRecipe and MultizoneMutedRecipe are added to perform sync of volume/muted for a multizone device. CastDeviceManager is rewritten to use existing similar recipes (currently in Cast) and CastMultizoneDeviceManager is implemented similarly.
  • A CastMultizoneDevice type is added, wrapping a GCKMultizoneDevice. This type is similar to CastDevice with only limited API relevant to multizone devices.
  • A MultizoneDevicesRecipe is created to sync the multizone devices. A multizoneDevices property is added to sync the array of multizone devices.
  • Volume and muted APIs are removed from Cast. Instead two methods deviceManager(for:) with similar signatures are added to retrieve a manager for a device or multizone device.

Tasks

  • Add new multizone device type.
  • Add new recipes:
    • Multizone devices.
    • Multizone volume.
    • Multizone muted.
  • Implement device managers:
    • Refactor existing current device management.
    • Add multizone device manager.
  • Synchronize multizone devices in Cast.
  • Replace volume/muted APIs in Cast with device manager creation APIs.
  • Find if there is a way to have common CastMuteButton and CastMuteIcon without code duplication.
  • Update existing volume slider to use the new API.
  • Display secondary sliders for multizone devices (if > 1).
  • Ensure correct behavior when part of the paired devices are disconnected.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

🚧 In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions