I'm doing this because Spotify has an annoying bug, where it cannot set the volume properly when I click (it instead picks a random low-numbered value like 0.23, than the one I chose 0.9.)
- open devtools (F12) > debugger > search
- search for:
this._harmony.setVolume
- click the "format source" button
- set breakpoint on it (
cdn/build/web-player/web-player.*.js:21600
) - adjust volume normally, to catch breakpoint
- input in console:
window.HARMONY = this._harmony
- remove breakpoint and continue
- now you can control from console:
(some PlayerAPIClientError errors are normal, if music has not begun playing)
await HARMONY.setVolume(0.9)
Harmony is the vendored web player module
a.k.a. window.webpackChunkclient_web[0][1]['4310']