As in mobile development, we have a common experience that needs be delivered to multiple devices.
Smart TV’s apps across all platforms, from Samsung to other brands, to setup boxes apps and even video game console apps share mostly the same functionality, features and solutions.
So as we mentioned before, we have the base of our TV app and we just need something to help us to deliver this experience all across all this devices.
Well, that little something is Samsungs new open source project TOAST! TV Oriented API Simplification for Multiplatform.
A very useful tool for TV Web application development that will enable developers to generate a multiple-platform using just a single code base.
TOAST works as the API layer for Smart TV applications, managing the most common features as: Video, Channel, System Info and Network.
So we want to do one of the most common tasks in a Smart TV application, which is playing a video.
For Legacy OS TV sets, we need to do the following steps:
- First we need to access the element containing the player by ID.
- Then open the Player,
- Then initialize the player with URL we want to play.
- And then start the playback.
Doing the same routine but for our Tizen based TVs involves the following:
- We use the global avplay object to first access the URL
- Then prepare the object for the playback.
- And finally just play the content.
Using TOAST, we accomplish the same even using fewer lines of code:
- Creating an instance of the media object.
- Getting the source of the video
- Then call the play method.
As we can see here we can reduce both routines into one, in the backstage of our application with the TOAST plug-in the exact opposite happened. We have our one code base that, depending on the Smart TV platform we want to build for, the TOAST plug-in will convert the lines of code into the ones we need.
In the next blog post we will see more in deep into the technical specifications.