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

Error: plugin "videoJsResolutionSwitcher" does not exist in react.js #128

Open
jasham opened this issue Feb 2, 2019 · 2 comments
Open

Comments

@jasham
Copy link

jasham commented Feb 2, 2019

Hello Everyone.

Need help with videojs-resolution-switcher plugin in react.js
I have installed videojs-resolution-switcher, when I am giving plugin parameter the compiler is not detecting videojs-resolution-switcher.

import React from 'react';
import videojs from "video.js";
import videoPath from '../../assets/tryDjango.mp4'
import videoJsResolutionSwitcher from 'videojs-resolution-switcher'

export default class VideoPlayer extends React.Component {
componentDidMount() {
// instantiate Video.js
this.player = videojs(this.videoNode, {

    autoplay: true,
    controls: true,
    
    plugins: {
        videoJsResolutionSwitcher: {
          default: 'low'
        }
    },

    sources: [
      { "type": "video/mp4", "src": `${videoPath}?sd`, "label" : 'SD', "res" :'480' },
      { "type": "video/mp4", "src": `${videoPath}?hd`, "label" : 'HD', "res" : '1080' }
  
    ],
  }, function onPlayerReady() {
  console.log('onPlayerReady', this)
}); 

}

getting the below error

Error: plugin "videoJsResolutionSwitcher" does not exist

any idea ?
I can use the video with out plugin but not able to use plugin.

Reagrds,
Jasham

@varpitoo
Copy link

varpitoo commented May 7, 2019

we are also facing the same issue

@dhamaniasad
Copy link

This plugin does not have a default export, so you need to do require("videojs-resolution-switcher"); to include it in the global scope. Also make sure to assign window.videojs = videojs for the plugin to work.

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