Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@clappr/clappr-tvs-key-mapping-plugin

Package Overview
Dependencies
Maintainers
5
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clappr/clappr-tvs-key-mapping-plugin

Maps smart TVs remote control keys to a common pattern for Clappr.

  • 1.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

npm bundle size PRs Welcome Travis (.com) Coveralls github

Clappr TVs key mapping plugin

Table of Contents

Features

:mage: One plugin to rule them all (remote controls)

Most 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.

:clapper: Clappr events FTW!

When 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.

:mag: console.log for the rescue

Enable/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.

Usage

You can use it from JSDelivr:

https://cdn.jsdelivr.net/npm/@clappr/clappr-tvs-key-mapping-plugin@latest/dist/clappr-tvs-key-mapping-plugin.min.js

or as an npm package:

# Using yarn
yarn add @clappr/clappr-tvs-key-mapping-plugin

# Using npm
npm i @clappr/clappr-tvs-key-mapping-plugin

Then just add the Watcher into the list of plugins of your player instance and set the device name to watch on tvsKeyMapping.deviceToMap config:

var player = new Clappr.Player({
  source: 'http://your.video/here.mp4',
  plugins: [TVsKeyMappingPlugin.Watcher],
  tvsKeyMapping: { deviceToMap: 'browser' },
});

Configuration

The options for the plugin go in the tvsKeyMapping property as shown below:

var player = new Clappr.Player({
  source: 'http://your.video/here.mp4',
  plugins: [TVsKeyMappingPlugin.Watcher],
  tvsKeyMapping: {
    deviceToMap: 'browser',
  },
});

deviceToMap {String}

This config is mandatory for the plugin. The name needs to be one of the currently mapped devices. The current mapped devices names are below:

NameDevice
browserThis option is for test the plugin on a desktop device in any web browser.
samsung_tizenSamsung smart TVs with Tizen OS (>= 2015 launch year).
samsung_orsaySamsung smart TVs with Orsay OS (<= 2014 launch year).
lg_webosLG smart TVs with WebOS (>= 2014 launch year).
panasonicPanasonic smart TVs.

API Documentation

Plugin API

methodargumentsdescription
plugin.startdeviceAdds a listener for remote control keydown events of the mapped device to send the key name on the Clappr events.
plugin.stopRemoves listener for remote control keydown events.
plugin.enableLogAdds a listener for remote control keydown events of the mapped device to log remote control key data.
plugin.disableLogRemoves listener for remote control keydown events that logging remote control key data.

Development

Install dependencies: npm install

Run: npm start

Test: npm test

Lint: npm run lint

Build: npm run build

Minified version: npm run release

Keywords

FAQs

Package last updated on 20 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc