cladera / videojs-offset

VideoJS plugin for play a segment of a video.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plugin is not added when using `import`

nicu-chiciuc opened this issue · comments

commented

Description

When using imports, the plugin is not registered on video.js

Steps to reproduce

  1. Create a new project with create-react-app.
  2. Add video.js and video.js-offsest
  3. In a VideoPlayer component (https://docs.videojs.com/tutorial-react.html) add this at the top:
import React from "react";
import videojs from "video.js";
import "videojs-offset";

Results

Expected

The plugin should work ok.

Error output

TypeError: this.offset is not a function

Additional Information

Please include any additional information necessary here. Including the following:

versions

videojs

^7.3.0

I could make this work by registering the plugin manually:

import offset from "videojs-offset";

videojs.registerPlugin("offset", offset);

I've also tried to select a video.js version that corresponds with the one in videojs-offset package.json.
I think what happens is that the plugin is registered for its own version of video.js.

Hi @nicu-chiciuc, yeah I'm experiencing this issue as well in my projects and it is probably related to this issue as well #38.

I don't have a fix for that but I'm investigating.