Adding Compiled WebAssembly Modules to TV Applications
This topic describes how to add already existing WebAssembly modules and their accompanying files to a TV application project.
Prerequisites
To embed an existing, working WASM application, in a TV application you need the following:
- Compiled WASM module(s) (".wasm")
- WASM source mappings (".wasm.map" files) - required for source level debugging only
- WASM modules' counterpart JavaScript code - either generated by Emscripten SDK or custom
- HTML code in which the modules are embedded
You can use this example WebAssembly application for reference.
Embedding a WebAssembly Application in a TV Application
- Create a new TV application project if not existing yet (it doesn't have to be a WebAssembly-enabled project since there will be no C/C++ source code to build).
- Copy all of the WASM module files to the newly created TV application project. To find the project's location:
- Right click the project and select "Properties"
- Click the "Resource" in the project's properties tree
- Check the "Location" property (see Fig. 1)
If you used the example WebAssembly application, extract all of its files to the TV application project location.
- Refresh the project by clicking it in the Project Explorer and pressing F5 key.
- Make sure that
<content src="index.html"/>
tag in the config.xml file points to an HTML file that either embeds the WASM modules directly or refers other HTML/JS files that do that.
In case of the example WebAssembly application the tag should read as:<content src="hello.html"/>
Once all the required files are in place you can launch the TV application to verify that it works properly - see Launching for details.
Note :
Launching and debugging TV application projects works the same way for both regular (HTML+JS only) and WebAssembly-Enabled projects.