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

feature(register): function for register plugin #607

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

feature(register): function for register plugin #607

wants to merge 1 commit into from

Conversation

PhilipeGatis
Copy link

@PhilipeGatis PhilipeGatis commented Aug 31, 2021

This feature provides a plugin register function. I follow this strategy.
Why?
I got an error (plugin record not found) when i import videojs and then import videojs-record. I discover the plugin auto register occurs in another instance of videojs. In this function, I pass my imported instance to the plugin register.

example of use:

import 'video.js/dist/video-js.css'
import videojs, { VideoJsPlayerOptions, VideoJsPlayer } from 'video.js'

import 'webrtc-adapter'
import RecordRTC from 'recordrtc'

import 'videojs-record/dist/css/videojs.record.css'
import { register } from 'videojs-record/dist/videojs.record'

register(videojs)

Copy link
Member

@thijstriemstra thijstriemstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please provide a pull request description? and revert changes to package-lock.json?

@PhilipeGatis
Copy link
Author

can you please provide a pull request description? and revert changes to package-lock.json?

Done! :)

Copy link
Member

@thijstriemstra thijstriemstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got an error (plugin record not found) when i import videojs and then import videojs-record.

are you using any frameworks? what error/stacktrace specifically?

@PhilipeGatis
Copy link
Author

I got an error (plugin record not found) when i import videojs and then import videojs-record.

are you using any frameworks? what error/stacktrace specifically?

React (CRA) with craco.
I got the same error on this issue!
I tried all resolutions suggested here. But withou success!

@kumaxim94
Copy link

kumaxim94 commented Aug 3, 2022

Hi!
any activity on this?
it would be great to have register function on this plugin

@thijstriemstra

@PhilipeGatis did you found a solution in your case? Facing the same troubles with vue.js, so decided to import it through cdn for now

@7Ds7
Copy link

7Ds7 commented Oct 21, 2022

I bumped into exactly the same thing using webpack, my debugging lead me to the same conclusion, as long as we are using a different videojs version from the one that is a dependency of the package the plugin will be applied to it's own videojs version and both versions will be imported

If one forces the plugin in to use the current version as our platform for example https://github.com/7Ds7/videojs-record/blob/master/package.json#L77 only that version is imported and the plugin is applied correctly.

This PR fixes that problem, furthermore i was inspecting old videojs plugin generators and when they build the final package they usually have this sort of check which

_videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null);

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

Successfully merging this pull request may close these issues.

4 participants