2.3.2 • Published 3 years ago
@halleymedia/webtvplayer-types v2.3.2
WebTvPlayer type definitions
Use this package to develop a custom skin for Halleymedia's WebTvPlayer v2.
Getting started
Install this package by running this command in your project.
npm install @halleymedia/webtvplayer-types
Then, create a JavaScript module like this one:
import WebTvPlayer from '@halleymedia/webtvplayer-types';
import WebTvPlayerSkin from '@halleymedia/webtvplayer-types/skins/WebTvPlayerSkin';
/**
* @implements {WebTvPlayerSkin}
*/
export default class MySkin {
/**
* @param {WebTvPlayer} playerInstance
* @returns {Object.<string, HTMLElement>}
*/
render(playerInstance) {
//You're encouraged to create small methods to create the UI
//and/or use a rendering library
const button = playerInstance.container.ownerDocument.createElement('button');
button.setAttribute('type', 'button');
button.innerText = 'Play';
button.addEventListener('click', function() { playerInstance.play(); }, false);
playerInstance.container.appendChild(button);
//You should return a custom element which will be used as the video container
return {
'player': playerInstance.container.ownerDocument.createElement('div')
};
}
destroy() {
//Cleanup here
}
}