Hey everyone, we just released an update to Channels that adds an HTTP API to let you control and query the Channels app.
Full confession: it’s partially been there for a while, that’s how the Play To features work from iOS , but now it’s more fleshed out and publicly available and documented!
So now you can do things like pause, resume, or stop your video remotely from something else. Do you dabble in home automation? Now you can control Channels with it! Do you hate that streams don’t stop when your TV is turned off? Integrate Channels into your home automation and now you can. I’ve been doing this for months, heh. It’s great.
It’s important to know and remember that the API will be as available as the platform it’s running on allows. For tvOS this means only when Channels is open and active. For Android and Fire TV it will work if Channels is active or backgrounded, but only if it has been launched at least once.
The API is super simple and you can use it directly from CURL. All endpoints respond with the current status of Channels.
Discovery
The Channels API advertises itself with Bonjour. You can search for all of the apps on your network with Bonjour using the _channels_app._tcp
service name.
Example
$ curl -X POST http://192.168.1.50:57000/api/pause
{
"status": "paused",
"muted": false,
"channel": {
"number": "552",
"name": "TBS HD",
"image_url": "http://fanc.tmsimg.com/h5/NowShowing/58515/s58515_h5_aa.png"
},
"now_playing": {
"season_number": 3,
"title": "Seinfeld",
"image_url": "http://fanc.tmsimg.com/assets/p183875_b_h6_ab.jpg",
"episode_title": "The Truth",
"episode_number": 2,
"summary": "A woman (Valerie Mahaffey) wants to know why George doesn't want to see her."
}
}
It’s as simple as that!
Not only is it available, we whipped up a couple of API clients so you can integrate Channels with any of your projects even faster. There’s a Python package and Ruby gem ready to go.
If you’re a Home Assistant fan, you’ll be excited to hear that a Channels component has already been added to it and will be in the next official release. A Homebridge plugin will be available a little later if you’re a Homekit user.
You can learn more about the Channels API on our site. We hope you have fun with it!