videojs-record: Play button doesn't work with video.js 6.2.0 and webpack
Description
Playing the recorded video doesn’t work with video.js 6.0.0 ~6.2.0
When you record a video and then press the play button noting happens.
Steps to reproduce
Install video.js ~6.2.0
Results
Expected
Should play the video.
Error output
Uncaught TypeError: videojs.getComponent is not a function
Additional Information
versions
videojs
what version of videojs does this occur with? video.js 6.2.0 videojs-record 1.6.1
browsers
what browser are affected? Tested in Firefox and Chrome
OSes
what platforms (operating systems and devices) are affected? Linux
About this issue
- Original URL
 - State: closed
 - Created 7 years ago
 - Comments: 42 (24 by maintainers)
 
Commits related to this issue
- exclude video.js 6.2.0 or newer until video.js module export issue is resolved (#149) — committed to collab-project/videojs-record by thijstriemstra 7 years ago
 - Modernize plugin (v2.0) (#170) - (videojs-)wavesurfer >= 2.0 (only) support - video.js >= 6.0 (only) support - new build system (using babel/browserify, with tests for webpack, fixes #149) - modul... — committed to collab-project/videojs-record by thijstriemstra 7 years ago
 
@gavfu You can alias
video.jsto use the non-ES6 version.Use something like this in your webpack config:
This is a quick workaround until this issue is resolved.
it’s ok. ESM is short for ES modules or Ecmascript modules. That is the
importandexportsyntax. CJS is commonjs, i.e., what nodejs uses and what bundlers used to use.A new release of this plugin (in short term) would pin video.js to anything < 6.2.0.
@thijstriemstra I could get down to the root of the problem. The problem is the combination of ES6 exports
export default videojsand requirejs importsrequire('video.js)video.js switched from
module.exports = videojsin 6.1.0 toexport default videojsin 6.2.0 And while videojs-record still uses require('video.js) and if you use ES6 stops working.https://github.com/videojs/video.js/blob/v6.1.0/src/js/video.js#L727 https://github.com/videojs/video.js/blob/v6.2.0/src/js/video.js#L726
So the fix to this is as I understand it to switch to ES6 imports or to change the require to
require('video.js).defaultBut I’m not really an expert regarding this subject.
Explanations of this problem: https://github.com/videojs/video.js/issues/2698#issuecomment-148151327 https://medium.com/@kentcdodds/misunderstanding-es6-modules-upgrading-babel-tears-and-a-solution-ad2d5ab93ce0
Getting same issue with
TypeError: videojs.getComponent is not a functionJust tested, it works if I use video.js like: “video.js”: “6.1.0”,
Linux with Firefox 54 and Chromium 58. Maybe it’s an Webpack problem. I’ll investigate in the next days and get back to you.