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

Plugin is not importable #83

Open
qubis741 opened this issue Sep 25, 2018 · 3 comments
Open

Plugin is not importable #83

qubis741 opened this issue Sep 25, 2018 · 3 comments

Comments

@qubis741
Copy link

Description

I am trying to use your plugin, via import statements. Problem is, that I can't get it working. I am getting error

Steps to reproduce

I have imported videojs and overlay plugin and try to register it, because when I didn't, I got error about function overlay to be undefined. Then I got error mentioned below

import videojs from 'video.js'
import overlay from 'videojs-overlay'
....
videojs.registerPlugin('overlay', overlay) // error
....
player.overlay({...})

Results

Expected

Expected to be working

Actual

Got error

Error output

VIDEOJS: ERROR: Error: Component Overlay does not exist
at Player.addChild (video.cjs.js:3361)
at videojs-overlay.es.js:371
at Array.map ()
at Player.plugin (videojs-overlay.es.js:347)
at Player.basicPluginWrapper [as overlay] (video.cjs.js:23094)
at videoTracking (application.js:130)
at Player. (application.js:92)
at HTMLDivElement.bound (video.cjs.js:2070)
at HTMLDivElement.data.dispatcher (video.cjs.js:1717)
at trigger (video.cjs.js:1849)

Additional Information

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

versions

videojs

"video.js": "^7.0.3",
"videojs-overlay": "^2.1.4"

browsers

Version 69.0.3497.100 (Official Build) (64-bit)

OSes

macOS High Sierra 10.13.6

plugins

"@dlive/videojs-resolution-switcher": "^0.6.0"

If I am doing something wrong, please help me and include it also in docs, because I haven't found any documentation about how to use your plugin with imports. Thanks

@qubis741
Copy link
Author

There was problem with imports inside plugin. Overlay imported other videojs than I did in app.js, even if "name" is the same. Quick fix is to copy videojs-overlay.es.js to your lib and import it like:
import '../lib/videojs-overlay'

You don't need to register plugin then.
Hope developers could find solution without this kinda forking

@ndevvy
Copy link

ndevvy commented Oct 30, 2018

if you import the plugin you don't need to call registerPlugin; the registration will happen when the module is imported. you should be able to just call player.overlay after importing.

@amirmasoud
Copy link

You can copy the file as @qubis741 said, I just impoorted it like this:

import "videojs-overlay/dist/videojs-overlay.es.js";

(context: I'm using VideoJS inside of a Vue component)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants