Cordova plugin that provides TV Specific functionalities.
This plugin defines a global toast
object, which provides an API for TV specific functionalities that is based on Cordova project.
Although the object provides the global scoped toast
object, it is not available until after the deviceready
event which is provided by Cordova.
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
console.log(toast);
}
If you want more details, please refer belows.
./
|-cordova-test-runner/ ... TestRunner/TestSuite Cordova application
|-docs/ .................. Documents which are including API Specification
|-sample/ ................ Sample applications using TOAST API
|-src/ ................... Platform dependent modules for the plugin TOAST
| |-browser/ ............ Plugin implementation for the platform `browser`
| |-sectv-orsay/ ........ Plugin implementation for the platform `sectv-orsay`
| |-sectv-tizen/ ........ Plugin implementation for the platform `sectv-tizen`
| `-tv-webos/ ........... Plugin implementation for the platform `tv-webos`
|-tasks/ ................. custom grunt tasks to build the toast.js
|-www/ ................... Platform independent modules for the plugin TOAST
|-Gruntfile.js ........... Gruntfile to build the toast.js
'-plugin.xml ............. Cordova Plugin configuration for TOAST
sectv-orsay
and sectv-tizen
and tv-webos
platforms.Feature Name | Browser | Legacy Samsung Smart TV | Tizen Samsung Smart TV | WebOS LG Smart TV | |||||
2012 | 2013 | 2014 | 2015 | 2016 | 2014 | 2015 | 2016 | ||
toast.Media | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
toast.MediaPlugin | No | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
toast.drminfo | Yes | Yes | Yes | Yes | Yes | Yes | No | No | No |
toast.application | Partly | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
toast.inputdevice | Partly | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
toast.tvaudiocontrol | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
toast.tvwindow | Yes | Yes | Yes | Yes | Yes | Yes | No | No | No |
toast.tvchannel | Yes | Yes | Yes | Yes | Yes | Yes | No | No | No |
IME | No | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
First, TOAST needs the followings. Please install these.
npm modules: cordova, grunt
$ npm install -g cordova
$ npm install -g grunt-cli
For copying repositories, please mkdir
a root directory.
$ mkdir <root directory>
In the root directory, please git clone
the following repositories.
$ git clone https://github.com/apache/cordova-js.git
$ git clone https://github.com/apache/cordova-browser.git
$ git clone https://github.com/Samsung/cordova-plugin-toast.git
$ git clone https://github.com/Samsung/cordova-sectv-orsay.git
$ git clone https://github.com/Samsung/cordova-sectv-tizen.git
$ git clone https://github.com/Samsung/cordova-tv-webos.git
$ git clone https://github.com/Samsung/grunt-cordova-sectv.git
Please npm install
to install dependencies in cordova-js
, cordova-plugin-toast
, cordova-sectv-orsay
, cordova-sectv-tizen
, cordova-tv-webos
, grunt-cordova-sectv
.
$ npm install
In cordova-js/Gruntfile.js
, please add compile tasks.
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
compile: {
...
"sectv-orsay": {},
"sectv-tizen": {},
"tv-webos": {}
},
In cordova-js/package.json
, please add the platforms to cordova-platforms
like below.
"cordova-platforms" : {
...
"cordova-sectv-orsay" : "../cordova-sectv-orsay",
"cordova-sectv-tizen" : "../cordova-sectv-tizen",
"cordova-tv-webos" : "../cordova-tv-webos"
}
In cordova-js
, please grunt compile
for packaging.
$ grunt compile:sectv-orsay compile:sectv-tizen compile:tv-webos
In cordova-plugin-toast
, please grunt compile
for packaging.
$ grunt compile:sectv-orsay compile:sectv-tizen compile:tv-webos
recommended workspace
./
|-cordova-js/ ............
|-cordova-browser/ .......
|-cordova-plugin-toast/ ..
|-cordova-sectv-orsay/ ...
|-cordova-sectv-tizen/ ...
|-cordova-tv-webos/ ......
`-grunt-cordova-sectv/ ...
create empty project
# Create cordova project
$ cordova create TestApp
$ cd TestApp
# Beware of hidden file
$ cp -rf ../grunt-cordova-sectv/sample/. ./
$ npm install ../grunt-cordova-sectv
# Grunt task for build and package
# Install dependency modules
$ npm install
# For toast browser simulator
$ cordova platform add browser
# Mandatory plugins for using browser simulator (not for other platforms)
$ cordova plugin add cordova-plugin-device
$ cordova plugin add cordova-plugin-network-information
$ cordova plugin add cordova-plugin-globalization
# Add toast plugin
$ cordova plugin add ../cordova-plugin-toast
www/index.html
<!-- REMOVE meta tag for setting CSP(Content-Security-Policy)
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
-->
<body>
...
<script type="text/javascript" src="https://github.com/Samsung/cordova-plugin-toast/raw/master/cordova.js"></script>
<!-- Add toast.js to use toast api -->
<script type="text/javascript" src="https://github.com/Samsung/cordova-plugin-toast/raw/master/toast.js"></script>
...
</body>
```
browser
$ cordova build browser
sectv-orsay
$ grunt sectv-prepare:sectv-orsay
sectv-tizen
$ grunt sectv-prepare:sectv-tizen
tv-webos
$ grunt sectv-prepare:tv-webos
browser
# Test on browser platform
$ cordova emulate browser
sectv-orsay
# Test on sectv-orsay platform
$ grunt sectv-build:sectv-orsay
# Run the application on target by using SDK
sectv-tizen
# Test on sectv-tizen platform
$ grunt sectv-build:sectv-tizen
# Run the application on target by using SDK
tv-webos
# Test on tv-webos platform
$ grunt sectv-build:tv-webos
# Run the application on target by using SDK
For more details, please refer the tizen package
Please refer to below for running the tests: (Assuming that the grunt-cordova-sectv project is cloned at the same level with this project)
# Create cordova project
$ cordova create TestRunner --template=cordova-plugin-toast/cordova-test-runner
$ cd TestRunner
# Beware of hidden file
$ cp -rf ../grunt-cordova-sectv/sample/. ./
$ npm install ../grunt-cordova-sectv
# Grunt task for build and package
# Install dependency modules
$ npm install
# For toast browser simulator
$ cordova platform add browser
# Mandatory plugins for using browser simulator (not for other platforms)
$ cordova plugin add cordova-plugin-device
$ cordova plugin add cordova-plugin-network-information
$ cordova plugin add cordova-plugin-globalization
# Add toast plugin
$ cordova plugin add ../cordova-plugin-toast
Not yet