Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Class constructor Plugin cannot be invoked without 'new' #45

Closed
alexkrycek opened this issue Mar 12, 2023 · 6 comments
Closed
Assignees
Labels
enhancement New feature or request vjs8 Video.js 8 compatiblity

Comments

@alexkrycek
Copy link

alexkrycek commented Mar 12, 2023

I'm using video.js 8.2.0, jQuery 3.6.4 and the most recent version of videojs-sprite-thumbnails. I'm receiving the following error message on Chrome, Brave and Edge:

videojs-sprite-thumbnails.js:291 Uncaught TypeError: Class constructor Plugin cannot be invoked without 'new'
at new SpriteThumbnails (videojs-sprite-thumbnails.js:291:22)
at Player.spriteThumbnails (video.js:27222:24)
at Player.onPlayerReady (playersetup.js:32:8)
at Player. (video.js:4318:16)
at Array.forEach ()
at Player. (video.js:4317:22)
at video.js:4951:9

This is my index.html:

<body>
    <script>
        const videoData = {
        "thumbsheet" : "thumbs/earth.png",
        "videoCover" : "images/earth.png",
        "videoSource-240p" : "",
        "videoSource-320p" : "",
        "videoSource-480p" : "",
        "videoSource-720p" : "",
        "videoSource-1080p" : "videos/earth-1080p.mp4",
        "videoSource-4k" : "",
      };
    </script>

    <div id="video_container">
      <video-js id="main_video_player" class="video-js"></video-js>
    </div>

    <script src="videojs/8.2.0/video.min.js"></script>
    <script src="jquery/jquery-3.6.4.min.js"></script>
    <script src="videojs/plugins/theater-mode-1.1.0/videojs.theaterMode.js"></script>
    <script src="videojs/plugins/sprite-thumbnails-0.6.0/videojs-sprite-thumbnails.js"></script>
    <script src="playersetup.js"></script>
  </body>

My playersetup.js:

videojs(
    'main_video_player', 
    {
        controls: true,
        autoplay: false,
        preload: 'metadata',
        playbackRates: [0.5, 1, 1.5, 2, 3],
    },
    function onPlayerReady() {
        this.src([{
            src: videoData["videoSource-1080p"],
            type: 'video/mp4'
        }]);

        // PLUGIN: videojs-sprite-thumbnails
        // Setup 256 x 144 thumbnails with an interval of five seconds
         this.spriteThumbnails({
             url: videoData["thumbsheet"],
             width: 256,
             height: 144,
             interval: 5
         });
    }
);

I can't figure out what I've done wrong. I'd appreciate any help. Thanks!

@alexkrycek alexkrycek changed the title TypeError: Class constructor cn cannot be invoked without 'new' TypeError: Class constructor Plugin cannot be invoked without 'new' Mar 12, 2023
@phloxic
Copy link
Owner

phloxic commented Mar 12, 2023

@alexkrycek thanks for filing this. I am already aware of the problem, i.e., as you I have tried and, unfortunately failed to make the plugin compatible with with video.js 8.

As soon as I find time I will dig further. Suggestions and patches welcome, of course ;-)

@phloxic
Copy link
Owner

phloxic commented Mar 14, 2023

@alexkrycek - the problem is the build skeleton provided by generator-videojs-plugin.

The 'raw' code itself works, as you can see here in a q&d demo.

@phloxic phloxic added the bug Something isn't working label Mar 14, 2023
@phloxic
Copy link
Owner

phloxic commented Mar 15, 2023

@alexkrycek - once the generator-videojs-plugin is compatible with v8 I will provide a v8 compatible sprite-thumbnails plugin.

@alexkrycek
Copy link
Author

Thank you! I'm sorry, I've been without Internet access.

@phloxic
Copy link
Owner

phloxic commented Apr 2, 2023

@alexkrycek - I think I found a solution which works without an update for he wait for the plugin generator.

The v8 demo uses it, if you want to have a look.

@phloxic phloxic added enhancement New feature or request vjs8 Video.js 8 compatiblity and removed bug Something isn't working labels May 7, 2023
@phloxic
Copy link
Owner

phloxic commented May 21, 2023

Closed via 75a4e5c

@phloxic phloxic closed this as completed May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request vjs8 Video.js 8 compatiblity
Projects
None yet
Development

No branches or pull requests

2 participants