Skip to content

videojs button to off/on #6

Closed
Closed
@anoosi

Description

@anoosi

i made a button to hide libassjs-canvas-parent but it's get Cannot read property 'style' of null

videojs('video').ready(function () {
// This would look more nice as a plugin but is's just as showcase of using with custom players
var video = this.tech_.el_;
window.SubtitlesOctopusOnLoad = function () {
var options = {
video: video,
subUrl: 'http://localhost/mp4/aaaa.ass',
fonts: ['http://localhost/mp4/css/Boahmed Alhour.ttf'],
//onReady: onReadyFunction,
//debug: true,
workerUrl: 'http://localhost/mp4/js/subtitles-octopus-worker.js',
};
window.octopusInstance = new SubtitlesOctopus(options); // You can experiment in console
};
if (SubtitlesOctopus) {
SubtitlesOctopusOnLoad();
}
var Button = videojs.getComponent('Button');
var MyButton = videojs.extend(Button, {
constructor: function() {
Button.apply(this, arguments);
this.addClass( 'vjs-subtitles-button' );
},
handleClick: function showhide() {
var div = document.getElementById('libassjs-canvas-parent');
if (div.style.visibility !== "hidden") {
div.style.visibility = "hidden";
}
else {
div.style.visibility = "visible";
}
}
});
videojs.registerComponent('MyButton', MyButton);
var player = videojs('video');
player.getChild('controlBar').addChild('myButton', {});
//LibassJsReady = function () {
//};
});

i just want to hide libassjs-canvas-parent instead stop SubtitlesOctopus
any idea ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions