Blog

TVMLKit First Impressions

When Apple announced the new Apple TV and tvOS, development seemed like business as usual from an iOS developers perspective. Looking at the API diffs between iOS 9.1 and tvOS 9.0, it is obvious that tvOS is a stripped down version of iOS (tvOS 9.t to 9.2 diffs show that Apple is still working towards adding more iOS capabilities to tvOS). One notable addition from iOS to tvOS is TVMLKit.  With TVMLKit Apple offers developers a way to leverage JavaScript and XML templates to very quickly create consistent native media experiences.  In the Introduction to TVMLKit tech talk it is revealed that many of the apps that ship with the new Apple TV actually use TVMLKit, including the App Store and iTunes movies apps along with others. I decided to take a look at just how easy it is to create a catalog app that looks like the iTunes movies app. This post provides an overview of my TVMLKit first impressions. Feel free to let me know yours. 

TVMLKit is able to leverage existing client-server architectures, but because I did not have one in place, the first step was to setup a simple server to host my JavaScript and media files.  There are ways to set this up on the device, but for this test I started one on my Mac.  Once that was setup and all my media was ready, I created the tvOS project in Xcode and headed over to the AppDelegate.  To use TVMLKit you are expected to create a TVApplicationControllerContext and a TVApplicationController in application(_:didFinishLaunchingWithOptions:).  This would also be the place to pass through other launch options to the TVApplicationControllerContext (think deep linking).  One thing of note is that it takes very few lines of Swift/Objective-C code to get started.  Once these two objects were setup, I was able to switch over to JavaScript to finish up the implementation.  The TVML Catalog sample source code was a great resource for getting a head start on what the JS/XML template should look like.  Here is what I ended up with:

TVMLKit_example

Each of the items opens a media player with a HLS stream using the native player chrome and all.  I feel the need to again emphasize this is a completely native experience written mostly in JavaScript.  No web view wackiness here (there is actually no web view component even available on tvOS).  Overall, I am impressed with TVMLKit and what it offers.  The template I used did the heavy lifting of creating the collection views and laying them out to match the look and feel of the iTunes movies app.  Implementing this experience from scratch using UIKit would indeed take more time and effort.  If you have a catalog of media on a server somewhere and are looking a user experience that matches that of many of the apps on the Apple TV, TVML is a very good place to start.

Ready to be Unstoppable? Partner with Gorilla Logic, and you can be.

TALK TO OUR SALES TEAM