WebAssembly provides a way to run code written in (among others) C and C++ on the web at near native speed.
WebAssembly is designed to complement and run alongside JavaScript - using the WebAssembly JavaScript APIs, you can load WebAssembly modules into a JavaScript Smart TV app and share functionality between the two.
WebAssembly is being developed as a web standard via the W3C WebAssembly Working Group and Community Group with active participation from all major browser vendors.
Samsung Smart TVs support WebAssembly from Tizen5.5 (2020 year's models) onwards.
Typical WebAssembly TV Application Composition
Application Contents
A WebAssembly TV application is composed of at least the following files:
An "index.html" file - defines the Web page that the WebAssembly modules run on. You can include other HTML5 and JavaScript elements, such as additional HTML files, CSS styles, and JavaScript code.
A "config.xml" file - contains the configuration for a Samsung TV application. This file is automatically generated by the Tizen Studio, but can be omitted when testing the application in a Web browser.
At least 1 ".wasm" file: a binary compiled using a WebAssembly toolchain.
HTML Web Page
The "index.html" file is a standard HTML file. To implement WebAssembly modules in the application, you need to use one of the methods presented on Loading and running WebAssembly code page. Tizen Studio generates required HTML and JavaScript code snippets that wrap one of those methods automatically when sample WebAssembly modules are added (see Adding WebAssembly Modules).
The ModuleLoader JavaScript class of the generated helper code supports passing canvas and textarea objects to it, so that the loaded WebAssembly module may work with both graphics and text output elements of the Web page.
Configuration File
The "config.xml" file is a Tizen-specific file that is created for every Tizen application. The file is automatically generated by the Tizen Studio. The following is an example of a "config.xml" file:
Usually you will want native code to exchange information with the Web page of your application, which may for example provide the user interface. There are several ways described of how to achieve that in Interacting with code. The document shows how native objects may be used from JavaScript code and vice versa.
It is also possible that the native code does not communicate with the Web page at all and it provides all the application functionality itself.
Application Code in C/C++
There are no specific requirements for the native application code but those regarding accessing native objects from JavaScript code - if needed - as described in Interacting with code.
To get started with some simple example you can therefore try a typical hello world example:
#include <iostream>
int main() {
std::cout << "Hello from native app" << std::endl;
return 0;
}
Required Tools
Samsung Emscripten fork
Tizen Studio with TV-Extension
Let's Create a WebAssembly TV App!
For a step-by-step guide showing how to install the required tools and create a working WebAssembly TV application see Getting Started.
We use cookies to improve your experience on our website and to show you relevant
advertising. Manage you settings for our cookies below.
Essential Cookies
These cookies are essential as they enable you to move around the website. This
category cannot be disabled.
Company
Domain
Samsung Electronics
.samsungdeveloperconference.com
Analytical/Performance Cookies
These cookies collect information about how you use our website. for example which
pages you visit most often. All information these cookies collect is used to improve
how the website works.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Functionality Cookies
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and
tailor the website to provide enhanced features and content for you.
Company
Domain
LinkedIn
.ads.linkedin.com, .linkedin.com
Advertising Cookies
These cookies gather information about your browser habits. They remember that
you've visited our website and share this information with other organizations such
as advertisers.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Preferences Submitted
You have successfully updated your cookie preferences.