2.0.1 • Published 1 year ago

@kokotree-inc/videojs-upnext-plugin v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

videojs-upnext-plugin

A plugin for video.js that displays an "Up Next" overlay when a video finishes playing.

Preview

Installation

Run npm install @kokotree-inc/videojs-upnext-plugin to install the plugin.

Usage

To use this plugin, simply import it and register it with your video.js player instance:

index.js

import videojs from 'video.js';
import '@kokotree-inc/videojs-upnext-plugin';

const player = videojs('my-player');

player.upnext({
  interval: 10,
  headText: 'Up Next',
  cancelText: 'Cancel',
  getTitle: () => {
    return 'Ocean Life';
  },
  getVideoImageUrl: () => {
    return 'https://vjs.zencdn.net/v/oceans.png';
  },
  playNext: () => {
    console.log('playNext');
  },
  cancel: () => {
    console.log('cancel');
  }
});

HTML

<html>
  <head>
    <link href="http://vjs.zencdn.net/8.9.0/video-js.css" rel="stylesheet" />

    <link href="index.css" rel="stylesheet" />
    <link href="upnext-styles.min.css" rel="stylesheet" />
  </head>
  <body>
    <div class="vid-container">
      <div
        class="video-js vjs-default-skin video-js-upnext-demo-player vjs-fluid video-js-upnext-demo-player-video-dimensions vjs-controls-enabled">
        <video id="video" controls></video>
      </div>
    </div>
    <script src="./index.js"></script>
  </body>
</html>

You can get upnext-styles.min.css from the root of this package.

Plugin Options

OptionTypeDefaultDescription
intervalnumber20The interval, in seconds, before the next video starts playing.
headTextstring'Up Next'The text displayed at the top of the Up Next card.
cancelTextstring'Cancel'The text displayed on the Cancel button.
getTitlefunction() => ''A function that returns the title of the next video to be played.
getVideoImageUrlfunction() => ''A function that returns the URL of the image to be displayed on the Up Next card.
playNextfunction() => {}A function that is called when the user clicks the "Play Next" button.
cancelfunction() => {}A function that is called when the user clicks the "Cancel" button.
2.0.1

1 year ago

2.0.0

1 year ago

1.0.92

2 years ago

1.0.91

2 years ago

1.0.90

2 years ago

1.0.89

2 years ago

1.0.88

2 years ago

1.0.84

2 years ago

1.0.83

2 years ago

1.0.82

2 years ago