Just wanted to say THANK YOU for the API! While watching the World Series tonight (Go Astros!), I found myself wishing there was a way to mute, not only the audio during commercials, but the video as well...
And then, I had a great idea: what if I could use the API to pause playback during the commercial breaks, skip forward after a preset length of time & auto-resume playback?
Well, with Home Assistant & the Channels API, I did just that! To have a physical remote, I repurposed a Zigbee Hue dimmer switch (with support for up to 8 different commands!) & assigned one of the buttons to an automation which does the following:
- /api/toggle_mute to mute audio
- /api/toggle_pause to pause playback
- "Wait for time to pass" (set for 3 minutes)
- /api/seek/175 (Most ad breaks are around 3 to 3 1/2 minutes, so I found 175 seconds is a nice sweet spot most of the time)
- "Wait for time to pass" (set for 250ms, just to allow for any network hiccups!)
- /api/toggle_pause to resume playback
- /api/toggle_mute to unmute audio
And done! I don't even have to see or think about the ads! Occasionally, the ad breaks run short or long, so two of the buttons on my remote are configured to issue /api/seek/15 & /api/seek/-10 commands, so I can jump around if needed. But for the most part, I've been timing it right & it will automatically resume playback just as the inning is starting! (For the record, this all seems to work best if you keep playback 15-30 seconds behind the live broadcast to allow for a buffer... but the tradeoff is so worth it to me!).
FYI, CURL commands need to be preconfigured in configuration.yaml under a shell_command section. Here's a couple of examples:
livingroomtogglepause: /usr/bin/curl -X POST 'ipaddresshere:57000/api/toggle_pause'
livingroomforwardlongskip: /usr/bin/curl -X POST 'ipaddresshere:57000/api/seek/175'
etc, etc... Then, call your CURL command in a Home Assistant automation with Call Service -> Shell command: commandname
FYI, I'm doing this on Apple TV. Make sure you give your device a static IP! And actually... my Zigbee remote is set to issue commands to multiple Apple TVs at once! It's a pretty good way to keep playback on multiple TVs (mostly!) in sync.
(And Devs, if you happen to see this...
I acknowledge it might not be possible because... "Apple", but... I use my iPad as a portable TV a LOT & this is exactly the kind of use case I have for wanting the API on my iPad & iPhone... Having a physical, custom remote for Channels (that can even control multiple devices at once) is INCREDIBLE!!)

Actually, I'm hoping for Stream Deck deal over the holidays. Having a more advanced remote, with channel logos & lots of buttons, would be a dream come true! (So glad macOS Shortcuts lets you run shell scripts! The Channels API really is incredibly useful...
)
