I'm trying to control the volume of the Apple Watch itself in code from SwiftUI.
I'm streaming audio using the AVPlayer.
Is there an API to set the Volume of the Watch or use to Digital Crown to control the volume without
- Setting the
volumeproperty on theAVPlayer. This just set the volume relative to the system volume. So if the system is muted it does not increase the volume. - Using the
WKInterfaceVolumeControl. This does the job, but it can not be sized does and takes a lot of space on the small screen.
The workaround I ended up with was this:
WKInterfaceVolumeControlto use it in SwiftUIVolumeViewto the view hierarchy withopacity = 0.With that you can update some other view, but keep in mind that especially on older what's the update does not always happen (immediately).