Simple plugin that displays a dropdown with a list of possible videos based on its resolution, also changes the source when the user selects a desired option
Hello. I am building spa using vue-cli v. 3.0.0-rc.5 and there are predefined webpack configuration. So I was wonder how to use video.js and videojs-qualityselector in my project.
I made a VideoPlayer vue component where imported videojs and qualityselector. But I got an error tells:
"player.qualityselector" is not a function.
When I called player.getPlugins() I saw there is no qualityselector plugin. So I guess the reason is that the plugin is registering inside plugins code. When we use webpack, for many imports it's just create links to code, but not to instance(only if we don't import a singleton, sure), So the instance that was used to register plugin in its own code wasn't the same instance used in the VideoPlayer component to create video player.
The solution is simple. The plugin should only export its constructor function as before, and then we manually register the plugin in the place it need to be used.
Does it way has the rights to life or there is other solution I didn't find?
Hello. I am building spa using vue-cli v. 3.0.0-rc.5 and there are predefined webpack configuration. So I was wonder how to use video.js and videojs-qualityselector in my project. I made a VideoPlayer vue component where imported videojs and qualityselector. But I got an error tells:
When I called
player.getPlugins()
I saw there is no qualityselector plugin. So I guess the reason is that the plugin is registering inside plugins code. When we use webpack, for many imports it's just create links to code, but not to instance(only if we don't import a singleton, sure), So the instance that was used to register plugin in its own code wasn't the same instance used in the VideoPlayer component to create video player.The solution is simple. The plugin should only export its constructor function as before, and then we manually register the plugin in the place it need to be used.
Does it way has the rights to life or there is other solution I didn't find?