Updating ExoPlayer — a subtitle

Ross Beazley
2 min readJun 4, 2019

--

Hello again, my name is Ross Beazley and I’m a developer in BBC Media Services. Our team within Media Services deal with integration of playback in the BBC mobile apps. I’ve been meaning to to write up some more on our ExoPlayer integration (its been three quarters of a year since the last post), in this post I shall talk about subtitles. For the uninitiated, subtitles are words displayed on a piece of media that translate or transcribe the dialogue or narrative (remember 888 on your UK tv?). This article describes how we verify our integration of subtitles using ExoPlayer.

I’ve added another test in F_ExoplayerStartsPlabackOfSubs.java. If you take a look at the source you can see it’s essentially the same as D_ExoplayerStartsPlaybackOfVideo.java, we fire up ExoPlayer with our subtitles file and sample the colour that is output.

Much like you might engineer your environment to make the robots job easier, we do the same thing. We restrict the size of ViewGroup in which we render subtitles to 100px by 100px and use a subtitles file that has quite a few lines of text so they fill the area. The subtitles themselves are styled in an unusual way. One set of subtitles has a background colour and font colour of Red, the other is green. By restircting the “view port” area, rendering lots of text and making forground and background colours the same we get an effect much like the Red/Green video from D_ExoplayerStartsPlaybackOfVideo.java.

We then sample the colour of the pixels on the screen and assert that the colours are correct for the current time in the stream. This is enough to assert that our integration of subtitles in ExoPlayer is correct.

I hope you find this of some use, wrangling with third party SDKs is something our team have to deal with daily and it’s important to know what is the appropriate type of test. Don’t test your third party SDK, test your integration of it.

As always, we are hiring, so if you are a junior or entry level software engineer who is interested in developing their software test (read design) capability, drop me a line.

--

--