The demand and use of Over-The-Top (OTT) services is increasing every year while traditional television subscriptions are decreasing. Watching content whenever and wherever is slowly becoming the norm. Subsequently, media companies have started to take notice and are allocating more resources to building OTT applications. Here at TribalScale, we’ve begun to build many applications for this innovative platform. I spent four months building an Amazon Fire TV application for a Fortune 500 Company and I will be sharing my experience and learnings with you.
One of the primary objectives of the application I worked on was to emulate cable sports television on the Amazon Fire TV. The project was written entirely in Kotlin and supports all Fire TVs, including Fire TV sticks. Building for Fire TV is extremely similar to building for Android because most of the libraries are the same, which offers a sense of familiarity to Android developers. But there are a couple of differences:
The aim was to emulate live television. It was also important to us that the user would be able to browse content while watching TV, and be able to fetch and display data in a short interval. This way, the user could always see the most up-to-date data. We also wanted to implement a caching strategy that was simple and effective. Achieving each of the stated goals was very important to us. But this was also a challenge because some of the lower-end Fire TV sticks were limited in terms of their hardware.
With hardware limitations on the older Fire TV sticks, the OS may kill apps in the background to free up memory for apps in the foreground. For a seamless TV experience, we needed to be able to persist data and resume the user-state whenever this would happen. So, a key lesson I learned was how to manage and persist data on the Fire TV. But since this problem is the same as an orientation change on Android devices, we tackled it as such, which really simplified things.
The RxJava2/RxAndroid Library and Kotlin really helped us write testable code while dealing with the complex business logic requirements — the github for the library is here. The observer/observable pattern is fantastic for streamlining and aggregating data from multiple sources in a synchronous matter. This software design pattern was predicated off stated changes, and how its dependents react to the change. Writing in Kotlin instead of Java also helped us streamline our code and reduce boilerplate code. Kotlin’s null safety, inline high order functions, standard functions, and smart cast features highlighted why it was advantageous to write the app in Kotlin rather than in Java.
I found that these libraries and techniques helped me build a Fire TV application that emulates live television, and emulating live television on OTT platforms is well worth it. OTT is on trend, and as more people are moving away from traditional TV subscription models OTT is likely going to continue growing. Developers will need to meet this demand, hopefully these learnings are helpful.
Vincent is an Agile engineer at TribalScale. He graduated from the University of Waterloo’s Computer Science program. He is passionate about technology, and is interested in blockchain and cryptocurrencies.