{"_id":"@clappr/clappr-tvs-key-mapping-plugin","_rev":"9-87993467b035eba074a39126b671d182","name":"@clappr/clappr-tvs-key-mapping-plugin","dist-tags":{"latest":"1.1.4"},"versions":{"1.1.4":{"name":"@clappr/clappr-tvs-key-mapping-plugin","version":"1.1.4","keywords":["clappr","smarttv","keys","controls","observer","watcher"],"author":{"name":"Joao Paulo Vieira","email":"vieira.joaopaulo.91@gmail.com"},"license":"BSD-3-Clause","_id":"@clappr/clappr-tvs-key-mapping-plugin@1.1.4","maintainers":[{"name":"towerz","email":"me@brunotorr.es"},{"name":"leandromoreira","email":"leandro.ribeiro.moreira@gmail.com"},{"name":"joaopaulo.vieira","email":"vieira.joaopaulo.91@gmail.com"},{"name":"vitorcavalcanti","email":"vrcavalcanti@gmail.com"},{"name":"jhonatan.gomes","email":"jhonatan.gomes93@gmail.com"}],"homepage":"https://github.com/clappr/clappr-tvs-key-mapping-plugin","bugs":{"url":"https://github.com/clappr/clappr-tvs-key-mapping-plugin/issues"},"dist":{"shasum":"a24e7da50a383f623cb11c1ce04d9f02f6fe94a5","tarball":"https://registry.npmjs.org/@clappr/clappr-tvs-key-mapping-plugin/-/clappr-tvs-key-mapping-plugin-1.1.4.tgz","fileCount":16,"integrity":"sha512-/gBDJdKzDqfiM67bqpQmFCznZdhIDNE6AiaZSp+Fyu5oxCEwa00ZCG1gI5N6wW6ODrDmiNPqZIYzHPCmhLyjig==","signatures":[{"sig":"MEUCIHFbmU2BvGiXGfEtlZUzm4Fn7vTY6cqxaGMwAsP9mv8rAiEAgRKYWwuwAIHZq0BDtaswjJJ13qA7QqiFZz7OD62l/Xc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":97196,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhH8dWCRA9TVsSAnZWagAA8BMP/ilI9PTc5BO1fmFFNzbd\nkPo/3pcbXhhmtMrf3jPXGhSNxaSzrKY5qcCkeSmxqdPWGfagzt9X+F6h0ks/\nCuBj0I/BCqC94RGcZ13AXXSnv83G5DouojPnC2xe0/WE/zg9JGIXqQ0zooof\n81BA1C83zBfMFX09LPgWqhWEfVvgkgTyiwfodm8h0MxYqoAhmnWeyV9A4vfz\nCHeIb32ZgBHRLHztoGERecuxptsieH5EN8lGq9jASTv1QfZnRLSjziPXGN/a\nlN9SPF9LQUbzddIReBaeo2DcVjMt7Mg6hx0ctocn6xCCa4OcvesE829sSaPh\n9vEvpHEtu5y902gFzpOTg3KqxI+pJnHSMFmRvTUj7vBznZwIFwHY+g4QzxV/\nwfu1VYmMSbsNG0aa+pb4F1yrjvh9JIHP6/D2jVka1e7hRPHOEIPKYbDaiEeU\nl5SFxRfnZ+Jh5lAjJpq5t8EorVlidG+vN//HDlr/w8IGUCDlyJjVVo3MGWyM\niUfSeORXTXNJBSnbqEg0tVcW9foYdLvy7etcge17PsOkSE5xjtb4P1Mlk00k\nE5z/DLYCMsjHWqQAPFcZOOv3HG/QONzMQwn7sZvE9zfegICw1GVmoaU/dVjb\nG8iWh8s1swgkA9GhstYWAAmkjGX3d9DM3bUITCF88kq03OwRbUc2XPC0GCAT\ncBaH\r\n=+Mta\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/clappr-tvs-key-mapping-plugin.js","module":"dist/clappr-tvs-key-mapping-plugin.esm.js","engines":{"node":">=10.0.0"},"gitHead":"8a2ec7e7a976eb0b1a9f8e4885ef7e062dadf55e","scripts":{"lint":"eslint src","test":"jest --coverage --silent","build":"rollup --config","start":"DEV=true rollup --config --watch","release":"MINIMIZE=true rollup --config","lint:fix":"eslint src --fix","test:debug":"node --inspect node_modules/.bin/jest --runInBand","bundle-check":"ANALYZE_BUNDLE=true rollup --config","test:coverage":"open coverage/lcov-report/index.html","prepublishOnly":"npm run release"},"_npmUser":{"name":"jhonatan.gomes","email":"jhonatan.gomes93@gmail.com"},"repository":{"url":"git+ssh://git@github.com/clappr/clappr-tvs-key-mapping-plugin.git","type":"git"},"_npmVersion":"6.14.11","description":"Maps smart TVs remote control keys to a common pattern for Clappr.","directories":{},"_nodeVersion":"14.16.0","browserslist":["> 0.5%","last 2 versions","not ie <= 11"],"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^26.6.3","eslint":"^7.23.0","rollup":"^2.44.0","coveralls":"^3.1.0","babel-jest":"^26.6.3","@babel/core":"^7.13.14","@clappr/core":"^0.4.18","@babel/preset-env":"^7.13.12","jest-mock-console":"^1.0.1","rollup-plugin-serve":"^1.1.0","rollup-plugin-sizes":"^1.0.4","@rollup/plugin-babel":"^5.3.0","rollup-plugin-terser":"^7.0.2","rollup-plugin-filesize":"^9.1.1","@rollup/plugin-commonjs":"^18.0.0","rollup-plugin-visualizer":"^5.3.0","@rollup/plugin-node-resolve":"^11.2.1","@babel/plugin-transform-runtime":"^7.13.10"},"peerDependencies":{"@clappr/core":"^0.4.18"},"_npmOperationalInternal":{"tmp":"tmp/clappr-tvs-key-mapping-plugin_1.1.4_1629472597920_0.8701428834629756","host":"s3://npm-registry-packages"}}},"time":{"created":"2021-08-20T15:16:37.821Z","modified":"2024-12-03T22:21:45.544Z","1.1.4":"2021-08-20T15:16:38.032Z"},"bugs":{"url":"https://github.com/clappr/clappr-tvs-key-mapping-plugin/issues"},"author":{"name":"Joao Paulo Vieira","email":"vieira.joaopaulo.91@gmail.com"},"license":"BSD-3-Clause","homepage":"https://github.com/clappr/clappr-tvs-key-mapping-plugin","keywords":["clappr","smarttv","keys","controls","observer","watcher"],"repository":{"url":"git+ssh://git@github.com/clappr/clappr-tvs-key-mapping-plugin.git","type":"git"},"description":"Maps smart TVs remote control keys to a common pattern for Clappr.","maintainers":[{"email":"me@brunotorr.es","name":"towerz"},{"email":"leandro.ribeiro.moreira@gmail.com","name":"leandromoreira"},{"email":"vieira.joaopaulo.91@gmail.com","name":"joaopaulo.vieira"},{"email":"jhonatan.gomes93@gmail.com","name":"jhonatan.gomes"},{"email":"pedrochmatos@gmail.com","name":"pedrochamberlain"},{"email":"felipe@felipeleao.com","name":"leaofelipe"},{"email":"paulocesarrosajr@gmail.com","name":"paulocesarrosajr"},{"email":"felipecesr@gmail.com","name":"felipecesr"},{"email":"lucioariel.furtado@gmail.com","name":"arielfurtado"}],"readme":"[![](https://data.jsdelivr.com/v1/package/npm/@clappr/clappr-tvs-key-mapping-plugin/badge)](https://www.jsdelivr.com/package/npm/@clappr/clappr-tvs-key-mapping-plugin)\n[![](https://img.shields.io/npm/v/@clappr/clappr-tvs-key-mapping-plugin.svg?style=flat-square)](https://npmjs.org/package/@clappr/clappr-tvs-key-mapping-plugin)\n[![](https://img.shields.io/npm/dt/@clappr/clappr-tvs-key-mapping-plugin.svg?style=flat-square)](https://npmjs.org/package/@clappr/clappr-tvs-key-mapping-plugin)\n[![npm bundle size](https://img.shields.io/bundlephobia/min/@clappr/clappr-tvs-key-mapping-plugin?style=flat-square)](https://bundlephobia.com/result?p=@clappr/clappr-tvs-key-mapping-plugin)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n![Travis (.com)](https://img.shields.io/travis/com/joaopaulovieira/clappr-tvs-key-mapping-plugin?style=flat-square)\n![Coveralls github](https://img.shields.io/coveralls/github/joaopaulovieira/clappr-tvs-key-mapping-plugin?style=flat-square)\n[![](https://img.shields.io/github/license/joaopaulovieira/clappr-context-menu-plugin?style=flat-square)](https://github.com/joaopaulovieira/clappr-context-menu-plugin/blob/master/LICENSE)\n\n<h1 align=center>Clappr TVs key mapping plugin</h1>\n\n## Table of Contents\n- [Features](https://github.com/clappr/clappr-tvs-key-mapping-plugin#Features)\n- [Usage](https://github.com/clappr/clappr-tvs-key-mapping-plugin#Usage)\n- [Configuration](https://github.com/clappr/clappr-tvs-key-mapping-plugin#Configuration)\n- [API Documentation](https://github.com/clappr/clappr-tvs-key-mapping-plugin#API-Documentation)\n- [Development](https://github.com/clappr/clappr-tvs-key-mapping-plugin#Development)\n\n## Features\n### :mage: One plugin to rule them all (remote controls)\nMost smart TV platforms implement their own key code for their remote controls. With this plugin, you can guarantee that the wanted action for one button is consistent through all mapped devices.\n\n### :clapper: Clappr events FTW!\nWhen the key of the mapped device is pressed, the plugin triggers one Clappr event with the key name on `core`(`CORE_SMART_TV_KEY_PRESSED`) and `container`(`CONTAINER_SMART_TV_KEY_PRESSED`) scope. This flow allows you to listen to one of those events and do what you want based on the returned key name.\n\n### :mag: `console.log` for the rescue\nEnable/disable log dynamically to check the key code and key name of each remote control key (and find out if the key is not mapped too!). The log uses `Clappr.Log` feature and is printed on the `INFO` level.\n\n\n## Usage\nYou can use it from JSDelivr:\n```\nhttps://cdn.jsdelivr.net/npm/@clappr/clappr-tvs-key-mapping-plugin@latest/dist/clappr-tvs-key-mapping-plugin.min.js\n```\nor as an npm package:\n```properties\n# Using yarn\nyarn add @clappr/clappr-tvs-key-mapping-plugin\n\n# Using npm\nnpm i @clappr/clappr-tvs-key-mapping-plugin\n```\n\nThen just add the `Watcher` into the list of plugins of your player instance and set the device name to watch on [tvsKeyMapping.deviceToMap](https://github.com/clappr/clappr-tvs-key-mapping-plugin#devicetomap-string) config:\n```javascript\nvar player = new Clappr.Player({\n  source: 'http://your.video/here.mp4',\n  plugins: [TVsKeyMappingPlugin.Watcher],\n  tvsKeyMapping: { deviceToMap: 'browser' },\n});\n```\n\n## Configuration\nThe options for the plugin go in the `tvsKeyMapping` property as shown below:\n```javascript\nvar player = new Clappr.Player({\n  source: 'http://your.video/here.mp4',\n  plugins: [TVsKeyMappingPlugin.Watcher],\n  tvsKeyMapping: {\n    deviceToMap: 'browser',\n  },\n});\n```\n\n### `deviceToMap {String}`\nThis config is mandatory for the plugin. The name needs to be one of the currently mapped devices. The current mapped devices names are below:\n\n| Name | Device |\n|------|--------|\n| `browser` | This option is for test the plugin on a desktop device in any web browser. |\n|`samsung_tizen`| Samsung smart TVs with Tizen OS (>= 2015 launch year). |\n|`samsung_orsay`| Samsung smart TVs with Orsay OS (<= 2014 launch year). |\n|`lg_webos`| LG smart TVs with WebOS (>= 2014 launch year). |\n|`panasonic`| Panasonic smart TVs. |\n\n## API Documentation\n\n### Plugin API\n| method | arguments | description |\n|--------|:---------:|-------------|\n| `plugin.start` | `device` | Adds a listener for remote control `keydown` events of the mapped device to send the key name on the Clappr events. |\n| `plugin.stop` | | Removes listener for remote control `keydown` events. |\n| `plugin.enableLog` |  | Adds a listener for remote control `keydown` events of the mapped device to log remote control key data. |\n| `plugin.disableLog` |  | Removes listener for remote control `keydown` events that logging remote control key data. |\n\n## Development\nInstall dependencies: `npm install`\n\nRun: `npm start`\n\nTest: `npm test`\n\nLint: `npm run lint`\n\nBuild: `npm run build`\n\nMinified version: `npm run release`\n","readmeFilename":"README.md"}