videojs-hotkeys icon indicating copy to clipboard operation
videojs-hotkeys copied to clipboard

Doesn't work with the latest video.js (export/import issue)

Open dearlordylord opened this issue 3 years ago • 0 comments

The issue seems to be quite simple; video.js changed how they expose their lib at some point (?) so the code

import videojs from 'video.js'; require('videojs-hotkeys');

would yield Uncaught TypeError: (e.registerPlugin || e.plugin) is not a function;

It seems that this is because var registerPlugin = videojs.registerPlugin || videojs.plugin; in videojs-hotkeys/videojs.hotkeys.js evaluates into undefined because videojs object there has .default property now that is supposed to be called instead.

A code like

var vjs = videojs.default || videojs;
var registerPlugin = vjs.registerPlugin || vjs.plugin;

would fix the issue but I'm not sure if It fixes the real problem instead of "symptoms"

dearlordylord avatar Mar 31 '21 13:03 dearlordylord