EMP Receiver documentation
The receiver is compliant with the default chromecast receiver API unless otherwise stated. For information on how to build a sender and other functionality not described here. See https://developers.google.com/cast/docs/sender_apps
Development
Starting development
As a developer you need to add custom ui-logic to the receiver-app and customize index.html file. To build the code there are a few requirements
- Node.js -- We use Node for build and test automation. Download and install Node.js
- grunt-cli
Unix-based systems
sudo npm install -g grunt-cli
Windows
npm install -g grunt-cli
To develop on the SDK, after cloning the repository you need to install the node.js modules using the node package manager
cd sdknpm install
to build a local copy of the receiver
grunt dist|build // build command has debugging enabled by default.
to generate jsdoc documentation (generated in sdk/docs)
grunt jsdoc
then deploy the reference
directory in any webserver and enjoy!
Grunt commands
Several grunt tasks are available for testing, development and distribution
grunt
grunt dev
builds the code and creates a local testing environment (on http://localhost:9999). Also watches the source code for any changes in /src and rebuilds when a change occurs
grunt watchAll
builds the code and creates a local testing environment (on http://localhost:9999). Also watches the source code for any changes in /src and /test and rebuilds when a change occurs
grunt dist
Creates packages available for distribution. in the /dist folder zipped archives can be found of the receiver. In addition to sources file ready for distribution.
Several simple grunt tasks are also available for use in specific cases
grunt jshint #ensures code is compliant with coding standards and warns for any coding issues grunt jsdoc #creates documentation based on source code comments grunt uglify #uglifys and minifys source grunt connect #setup local testing environment (on http://localhost:9999). grunt zip #creates a zip for distribution of the source grunt copy #possible variations: build, dist, images. plugins
About the code
Javascript for the Receiver will be written using the new ES6 standard. Using grunt tasks this is then re-written to the ES5 standard where available. To learn more about Es6 see babel. To keep our code clean and separated, we uses Browserify. This allows us to use require statements to import javascript code from other files.
All of the above is done automatically using the grunt build system, but during development one should be aware of the power, and the limitations of both systems.
separate ui-logic
The Receiver has separate ui-logic and playback-logic. emp-receiver playback-logic is installed from a npm package. Run npm install to get all depending npm packages. As a developer you need to add custom ui-logic to the receiver-app and customize index.html file. Receiver-app should implement event listener for METADATA_UPDATED: fire when program changed, should be used to display title and images about the current program. STATE_CHANGED: fire when playback state changed, should be used to display play icon, buffer spinner etc. emp-receiver expose the inner emp-player, other playback event can be handle directly on the emp-player. Receiver-app.js and index.html are samples how to implement a custom emp-receiver.
EmpHtmlPlayer
The receiver makes use of emp-player.