justintv / Twitch-API

A home for details about our API
www.twitch.tv
1.72k stars 381 forks source link

HLS edge caching impossible due to TLS #592

Closed ti-mo closed 7 years ago

ti-mo commented 7 years ago

Not strictly related to the Twitch API, but to the streaming service itself.

We run transparent proxies to briefly cache HLS chunks at LAN events with very limited internet bandwidth. We have no control over the participant's machines. One such example can be found at https://github.com/ti-mo/ansible-lanparty/blob/master/lp-twitch/templates/twitch.site.j2. I've noticed Twitch now does HLS delivery over TLS, which makes this caching setup impossible.

While I applaud ubiquitous encryption across the web, this will impact Twitch performance negatively at our events. Part of the caching strategy involved manipulating the .m3u8 file to include only one or two qualities to force clients to fetch the same HLS chunks.

Could a workaround to this be considered / implemented? An example of how Riot Games did this can be found at https://github.com/ti-mo/ansible-lanparty/issues/8. (HTTP fallback when segments are fetched from RFC1918 (and IPv6-equivalent) addresses.