Need private packages and team management tools?Check out npm Teams »

@ndxlabs/ndx-js

2.1.1 • Public • Published


NPM Version GitHub top language GitHub License Dependencies


NDX is the industry's new standard for connecting information to movies and television. NDX improves the TV viewing experience by connecting audiences with more information about the actors and locations they see on screen.

Installation

Using either NPM or Yarn:

npm install @ndxlabs/ndx-js
yarn add @ndxlabs/ndx-js

Usage

Javascript

 
<div class="ndx-embed"></div>
 
<script src="https://unpkg.com/@ndxlabs/ndx-js"></script>
<script>
 
  ndx.configure({
    apiKey: 'ab3rGRg4iwC5Qy...',
    analytics: true,
    onReady() {},
  });
 
  const tech = ndx.Tech('.ndx-embed', '1234567...', {
    list: {
      orientation: ndx.HORIZONTAL,
      size: ndx.SMALL,
      view: ndx.LIST,
      timeBased: true,
      style: {
        position: 'absolute',
        bottom: '2em',
        left: '0',
        padding: '0 2em'
      },
      onItemSelected(content) {
        // doSomethingWithSelectedContent(content);
      }
    },
    detail: {
      relatedContent: true,
      useTMDb: true,
      onOpen(content) {
        // Optionally inject recommended content
        tech.detail.injectRelatedContent(
          lookUpRecommendedContent(content.item.title);
        );
      },
      onClose() {
        // doSomethingAfterClose();
      }
    }
  });
 
  tech.list.show().updateTime(5);
 
</script> 
 

React

 
import React from 'react';
import { withRouter } from 'react-router';
import { NDX, ndx } from '@ndxlabs/ndx-js';
 
import Controls from '../../components/Controls';
import Player from '../../components/Player';
 
const Watch = withRouter(({ match, store }) => {
  const { videoId } = match.params;
  const { playing, currentTime } = store.getState().player;
 
  const _onItemSelected = (content) => {
    // deepLinkToContent(content.id);
  };
 
  return (
    <div className="watch-page">
      <NDX apiKey={process.env.REACT_APP_NDX_API_KEY} analytics={true} />
      <Player>
        <Controls />
        <NDX.Tech 
          videoId={videoId} 
          show={!playing}
          currentTime={currentTime}
          onItemSelected={_onItemSelected}
          list={{
            orientation: ndx.VERTICAL,
            style: {
              position: 'absolute',
              top: '2em',
              left: '2em',
            },
          }} />
      </Player>
    </div>
  );
});
 

Install

npm i @ndxlabs/[email protected]

Version

2.1.1

License

AGPL-3.0-or-later

Unpacked Size

433 kB

Total Files

10

Homepage

ndx.video

Last publish

Collaborators

  • avatar