silvermine/videojs-chromecast

Uncaught TypeError: Cannot set property 'Class' of undefined at class.js:5

Opened this issue · 3 comments

Hey I am working on a PWA with Angular Version 10 and Ionic.
When I am trying to implement the ChromeCast Plugin I receive the following Error

image

Does anybody know how to fix that error?
I did everything as in the ReadMe.

Sounds like the plugin cannot find your player instance. Likely something is wrong with your initialization. Can you provide your code or a reduced example?

Hello, I actually just came across this same exact error but I'm using ReactJs16 and Webpack4.

Installed with

yarn add @silvermine/videojs-chromecast
<script type="text/javascript" src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1"></script>

Imported with

import videojs from 'video.js';
import chromecast from '@silvermine/videojs-chromecast';
import '@silvermine/videojs-chromecast/dist/silvermine-videojs-chromecast.css';

Initialised with

chromecast(videojs);

I believe this error comes from the class.extend package. Locally, I updated @silvermine/videojs-chromecast to use an almost identical package https://www.npmjs.com/package/class-extend and I believe the problem was resolved.

However, I see there is already a PR to upgrade @silvermine/videojs-chromecast to use ES6 Classes, removing the need for class.extend altogether. Hopefully this PR will be released soon.

I hope this helps.

Kind regards

class.extend is removed in the latest master. Can you try the latest master and see if it works?