What’s the issue?

At work we had an issue with our Roku’s app, it was impossible to play all the long videos, by long I mean at least 3 hours.
When we clicked to play the video, it started loading but finally failed and we were redirected to the video page without any error.

A video is just a HLS manifest containing:

  • all the video’s chunks
  • all the captions files (webvtt) for each language, but not chunked

Analysis and debug

It took a colleague and me a whole evening to figure out what was happening.
We had a Roku 4K and a Roku stick to do all our tests.
We also had a list of videos with this issue.

So we started trying to play on both devices all the videos we got. After a couple hours we saw that if we tried to play multiple times (3 or 4) a video, the progress bar was going further and further and in the end we were able to play! It was working only for the videos of 3 hours, so we were still unable to play all the 4h+ videos.
It was a start, the funny fact is after being able to play a video one time, we were then able to play this same video without any issue.

We made a break and ask ourself what it could be, I was thinking about some limitation on a file size (buffer issue), but the video has already been chunked so it didn’t make sense. He proposed to remove the captions so we will be sure that’s the video (or not). And … that’s it! Without the captions declared in the HLS manifest we were able to play. After all we have a lead!

With only half the captions it was playing, it was definitely something linked to the captions size. We tried to keep as much as possible lines in the caption file and depending on the movie it was playing until 3500-3700 lines. After 3800 impossible to play.

We were pretty happy of our discovery, so we sent an email to the Roku support to see if there was a limitation that we weren’t aware of. Then we went home.

Two days later we had an answer! But not really a useful one … they were just asking questions on our delivery infrastructure and if maybe it’s not our CDN fault.
After multiple emails, I decided to be more technical and talk about a buffer issue and giving some examples of our caption size (between 200KB and 500KB). And that’s it! The buffer for the captions is only 256KB, which explains everything.

The solution

The solution is to split the captions into 100KB chunks, and it’s pretty easy to update the m3u8 manifest to support that.
Why 100KB? Because the Roku device is loading 2 chunks at the same time (200KB) and we don’t want to be near the limit.

On the top of the cake

We had an other issue with the captions and Roku, on the old devices like Roku I or II or even the express, it was impossible to have captions on all the videos (even if they were detected and enabled)!
The splitting fixed everything.


I hope it helps!

Vues : 730