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

registering plugins #70

Open
lwthatcher opened this issue Jun 28, 2017 · 3 comments
Open

registering plugins #70

lwthatcher opened this issue Jun 28, 2017 · 3 comments

Comments

@lwthatcher
Copy link

Registering Plugins

I added vjs-video in my angular app, and it has worked great thus far. Now I'm trying to add a couple of plugins, and I can't seem to get them to work.

Problem

I've tried registering the plugins by specifying options using the vjs-setup directive, and specifying these in my controller:

HTML:

<video vjs-ratio="14:9" vjs-setup="$ctrl.vidopts" class="video-js vjs-big-play-centered" ng-src="{{$ctrl.urls.movie}}" controls vjs-video>
</video>

Component's Controller:

// video.js options
this.vidopts = {
     "playbackRates": [ 0.25, 0.5, 1, 1.5, 2],
      "hotkeys": {seekStep: 5},
       plugins: {
           videoJsResolutionSwitcher: {
                    default: 'low',
                    dynamicLabel: true
          }
     }
}

I tried registering the plugins using both formats, but neither seem to work.

The playbackRates parameter works as expected, but none of the plugins seem to take effect...

Is there a convenient workaround for this with vjs-video?

Plugins

I've been attempting this with the following plugins:
videojs-resolution-switcher
videojs-hotkeys

A look at these plugins suggests they self-register with videojs at the end of their scripts:

console.log('registering hotkeys plugin'); // I added this line, and the console says it is called...
videojs.plugin('hotkeys', hotkeys);
@lwthatcher
Copy link
Author

Update

I've found a workaround that seems to work, if I register the plugins after the player has been returned by the vjsVideoReady function:

$scope.$on('vjsVideoReady', function(e, data) {
    console.log('vjs video ready', e, data);
    ctrl.videoClip = data.player;
    // register plugins
    ctrl.videoClip.hotkeys({seekStep: 5});
})

@ghost
Copy link

ghost commented Jun 30, 2017

This is definitely not ideal. I will investigate the issue this weekend.

@sudarsangp
Copy link

@lwthatcher It would be of great help if you could create a plnkr or jsfiddle to show how you have integrated the plugins (hotkeys) with vjs-video.
I am trying to figure out how to integrate videojs-contrib-hls plugin.

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

2 participants