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

Adding button with plugin not working in lastest version #2578

Closed
Albermg7 opened this issue Sep 10, 2015 · 3 comments
Closed

Adding button with plugin not working in lastest version #2578

Albermg7 opened this issue Sep 10, 2015 · 3 comments

Comments

@Albermg7
Copy link

Hello,
I am trying to implement a plugin for videoJs jsut to add a button to the control bar. I have followed seen how to do it in some tutorials but it is not working in the last version (4.12). I have downloaded an oldest version (this dev version) directly from a demo page and maggicallyl it is working. The code is this:

    // Create the button
    videojs.InfoButton = videojs.Button.extend({
        init: function (player, options) {
            // Initialize the button using the default constructor
            videojs.Button.call(this, player, options);
            this.on('click', this.onClick);
        }
    });

    videojs.InfoButton.prototype.createEl = function () {
        var props = {
            className: 'vjs-info-button vjs-control',
            innerHTML: '<div class="vjs-info-button vjs-control-content"><span class="vjs-control-text">' + ('InfoButton') + '</span></div>',
            role: 'button',
            'aria-live': 'polite', // let the screen reader user know that the text of the button may change
            tabIndex: 0
        };

        return videojs.Button.prototype.createEl(null, props);
    };

    videojs.InfoButton.prototype.onClick = function () {
        alert("INFO!");
    };

    // Video.js Plugin Code 
    videojs.plugin('infoButton', function (options) {
        options = options || {};
        this.controlBar.addChild('InfoButton', options);
    });

With the latest version, the videojs.InfoButton.prototype.createEl function is actually not being called. So, is there a new way to do this? What have changed in new versions that is preventing my code from working properly?
Thansk a lot

@Albermg7 Albermg7 changed the title Adding button with plugin not working in the last version Adding button with plugin not working in last version Sep 10, 2015
@Albermg7 Albermg7 changed the title Adding button with plugin not working in last version Adding button with plugin not working in lastest version Sep 10, 2015
@forbesjo
Copy link
Contributor

Are you using the minified version of video.js? It looks like createEl is not available when minified so it is recommended to use the unminified version of video.js.

See #2016

@Albermg7
Copy link
Author

Thanks forbesjo! That seems to be the problem. Since I have tried the minified version of the video.js used in the demo page I said and the plugin is not working either.

Can the unminified version be downloaded from the CDN?

@gkatsev
Copy link
Member

gkatsev commented Nov 17, 2015

Unfortunately, the unminified version of v4 isn't available on the CDN.
However, v5 is out and updating would be the recommended approach. It is available on the CDN in both minified and unminified flavors. See the change details page on the wiki for how to update.

@gkatsev gkatsev closed this as completed Nov 17, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants