This section describes the Tizen WASM Video Decoder sample application and how to use it.
Tizen WASM Player API Documentation
WebAssembly Getting Started
Tizen WASM Video Decoder Sample
The Tizen WASM Video Decoder sample application shows how to use Tizen WASM Video Decoder to play media on a Samsung device using a WebAssembly module.
This application is an extension to the Tizen WASM Player Sample Application. It illustrates how to extend an existing WASM Player application to achieve decoding video frames to GL texture functionality.
The emss_sdf_sample.h and emss_sdf_sample.cc files have been copied from the wasm_player_sample application and are used only to manage playback in media player. Video Decoder logic is located in the video_decoder_sdf_sample.h and video_decoder_sdf_sample.cc files.
emss_sdf_sample.h
emss_sdf_sample.cc
wasm_player_sample
video_decoder_sdf_sample.h
video_decoder_sdf_sample.cc
The sample application's features are:
HTMLMediaElement
ElementaryMediaStreamSource
kVideoTexture
Packetized data is hardcoded in the application to maximize data access simplicity.
This section covers how to build the sample widget in Tizen Studio, including prerequisites and a step by step guide to the build process.
To build the sample application, you need the following:
To build the sample application:
Launch Tizen Studio.
Create a new WebAssembly-enabled project in Tizen Studio:
VideoDecoderSample
Note For details on Emscripten configuration in Tizen Studio, see Configuring the Samsung Emscripten SDK.
For details on Emscripten configuration in Tizen Studio, see Configuring the Samsung Emscripten SDK.
Add a new WebAssembly module to the project:
VideoDecoderSampleModule
Replace the default HTML5 and C++ files generated by Tizen Studio with the files from this sample:
Remove generated HTML5 and C++ files:
VideoDecoderSample/index.html
VideoDecoderSample/main.js
VideoDecoderSample/css/style.css
VideoDecoderSampleModule/inc/empty.hpp
VideoDecoderSampleModule/src/empty.cpp
Copy the sample widget's files to the project in Tizen Studio:
elementary_media_stream_source_sample/widget/*
VideoDecoderSample/
elementary_media_stream_source_sample/src/*
VideoDecoderSampleModule/
Add the necessary compiler and linker flags to the WebAssembly module:
-std=gnu++11
-std=gnu++14
-s ENVIRONMENT_MAY_BE_TIZEN -pthread -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=1
Note These flags are explained below, in the Required Samsung Emscripten SDK Flags section.
These flags are explained below, in the Required Samsung Emscripten SDK Flags section.
-s EXPORT_NAME=EMSSSampleModule -s MODULARIZE=1
Note This step is required, because code loading for modularized and non-modularized WebAssembly modules differs slightly. The EMSS Sample application is prepared to load modules that do not use the MODULARIZE option.
This step is required, because code loading for modularized and non-modularized WebAssembly modules differs slightly. The EMSS Sample application is prepared to load modules that do not use the MODULARIZE option.
MODULARIZE
Build the project:
Create an application package:
The application is ready to use!
The table below explains Emscripten-specific build flags required to build this sample:
-s ENVIRONMENT_MAY_BE_TIZEN
-pthread -s USE_PTHREADS=1
-s PTHREAD_POOL_SIZE=1