1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00

videojs update

This commit is contained in:
Daniel Neto 2023-06-30 11:41:25 -03:00
parent 7581f1e883
commit 87721585c1
10 changed files with 95 additions and 93 deletions

View file

@ -1,24 +1,26 @@
// Extend default // Extend default
$(document).ready(function () { $(document).ready(function () {
setTimeout(function(){ if(typeof player == 'undefined'){player = videojs(videoJsId);} setTimeout(function() {
if(typeof player == 'undefined') {
player = videojs(videoJsId);
}
var Button = videojs.getComponent('Button'); var Button = videojs.getComponent('Button');
var nextButton = videojs.extend(Button, {
//constructor: function(player, options) { class NextButton extends Button {
constructor: function () { constructor() {
Button.apply(this, arguments); super(...arguments);
//this.addClass('vjs-chapters-button'); this.addClass('next-button');
this.addClass('next-button'); this.addClass('vjs-button-fa-size');
this.addClass('vjs-button-fa-size'); this.controlText("Next");
this.controlText("Next"); }
}, handleClick() {
handleClick: function () { document.location = autoPlayVideoURL;
document.location = autoPlayVideoURL; }
} }
// Register the new component
videojs.registerComponent('NextButton', NextButton);
player.getChild('controlBar').addChild('NextButton', {}, getPlayerButtonIndex('PlayToggle')+1);
}, 30);
}); });
// Register the new component
videojs.registerComponent('nextButton', nextButton);
player.getChild('controlBar').addChild('nextButton', {}, getPlayerButtonIndex('PlayToggle')+1);
}, 30); });

View file

@ -233,24 +233,27 @@ $name = $plp->getName();
} }
}); });
setTimeout(function () { setTimeout(function () {
if (typeof player == 'undefined') {
player = videojs(videoJsId);
}
var Button = videojs.getComponent('Button'); var Button = videojs.getComponent('Button');
var nextButton = videojs.extend(Button, {
//constructor: function(player, options) { class NextButton extends Button {
constructor: function () { constructor() {
Button.apply(this, arguments); super(...arguments);
//this.addClass('vjs-chapters-button');
this.addClass('next-button'); this.addClass('next-button');
this.addClass('vjs-button-fa-size'); this.addClass('vjs-button-fa-size');
this.controlText("Next"); this.controlText("Next");
},
handleClick: function () {
player.playlist.next();
} }
}); handleClick() {
document.location = autoPlayVideoURL;
}
}
// Register the new component // Register the new component
videojs.registerComponent('nextButton', nextButton); videojs.registerComponent('NextButton', NextButton);
player.getChild('controlBar').addChild('nextButton', {}, getPlayerButtonIndex('PlayToggle') + 1); player.getChild('controlBar').addChild('NextButton', {}, getPlayerButtonIndex('PlayToggle') + 1);
}, 30); }, 30);
}); });

View file

@ -1,20 +1,20 @@
var Button = videojs.getComponent('Button'); var Button = videojs.getComponent('Button');
var playListProgramButton = videojs.extend(Button, { class PlayListProgramButton extends Button {
//constructor: function(player, options) { constructor() {
constructor: function () { super(...arguments);
Button.apply(this, arguments);
this.addClass('playListProgram-button'); this.addClass('playListProgram-button');
this.controlText("playListProgram"); this.controlText("playListProgram");
}, }
handleClick: function () {
handleClick() {
console.log('playListProgramButton clicked'); console.log('playListProgramButton clicked');
$('#playListHolder').fadeToggle(); $('#playListHolder').fadeToggle();
} }
}); }
videojs.registerComponent('playListProgramButton', playListProgramButton); videojs.registerComponent('PlayListProgramButton', PlayListProgramButton);
player.getChild('controlBar').addChild('playListProgramButton', {}, getPlayerButtonIndex('fullscreenToggle') - 1); player.getChild('controlBar').addChild('PlayListProgramButton', {}, getPlayerButtonIndex('fullscreenToggle') - 1);
function playListFadeIn() { function playListFadeIn() {
$('#playListHolder').fadeIn(); $('#playListHolder').fadeIn();

View file

@ -1,14 +1,13 @@
var Button = videojs.getComponent('Button'); var Button = videojs.getComponent('Button');
var autoplayButton = videojs.extend(Button, { class AutoplayButton extends Button {
//constructor: function(player, options) { constructor() {
constructor: function () { super(...arguments);
Button.apply(this, arguments);
this.addClass('autoplay-button'); this.addClass('autoplay-button');
this.controlText("autoplay"); this.controlText("autoplay");
setTimeout(function(){avideoTooltip(".autoplay-button","Autoplay");},1000); setTimeout(function(){avideoTooltip(".autoplay-button","Autoplay");},1000);
}, }
handleClick: function () { handleClick() {
console.log('autoplayButton clicked'); console.log('autoplayButton clicked');
if($('.autoplay-button').hasClass('checked')){ if($('.autoplay-button').hasClass('checked')){
disableAutoPlay(); disableAutoPlay();
@ -16,8 +15,8 @@ var autoplayButton = videojs.extend(Button, {
enableAutoPlay(); enableAutoPlay();
} }
} }
}); }
videojs.registerComponent('autoplayButton', autoplayButton); videojs.registerComponent('AutoplayButton', AutoplayButton);
player.getChild('controlBar').addChild('autoplayButton', {}, getPlayerButtonIndex('fullscreenToggle') - 1); player.getChild('controlBar').addChild('AutoplayButton', {}, getPlayerButtonIndex('fullscreenToggle') - 1);
checkAutoPlay(); checkAutoPlay();

View file

@ -1,20 +1,20 @@
var Button = videojs.getComponent('Button'); var Button = videojs.getComponent('Button');
var EPGButton = videojs.extend(Button, { class EPGButton extends Button {
//constructor: function(player, options) { constructor() {
constructor: function () { super(...arguments);
Button.apply(this, arguments);
this.addClass('EPG-button'); this.addClass('EPG-button');
this.controlText("TV Guide"); this.controlText("TV Guide");
setTimeout(function(){avideoTooltip(".EPG-button","TV Guide");},1000); setTimeout(function(){avideoTooltip(".EPG-button","TV Guide");},1000);
}, }
handleClick: function () {
handleClick() {
var url = webSiteRootURL+'plugin/PlayerSkins/epg.php'; var url = webSiteRootURL+'plugin/PlayerSkins/epg.php';
url = addQueryStringParameter(url, 'videos_id', mediaId); url = addQueryStringParameter(url, 'videos_id', mediaId);
console.log('epg clicked'); console.log('epg clicked');
avideoModalIframeFullTransparent(url); avideoModalIframeFullTransparent(url);
} }
}); }
videojs.registerComponent('EPGButton', EPGButton); videojs.registerComponent('EPGButton', EPGButton);
player.getChild('controlBar').addChild('EPGButton', {}, getPlayerButtonIndex('fullscreenToggle') - 1); player.getChild('controlBar').addChild('EPGButton', {}, getPlayerButtonIndex('fullscreenToggle') - 1);

View file

@ -2,17 +2,17 @@ $(document).ready(function () {
var Button = videojs.getComponent('Button'); var Button = videojs.getComponent('Button');
var Logo = videojs.extend(Button, { class Logo extends Button {
//constructor: function(player, options) { constructor() {
constructor: function () { super(...arguments);
Button.apply(this, arguments);
this.addClass('player-logo'); this.addClass('player-logo');
this.controlText(PlayerSkinLogoTitle); this.controlText(PlayerSkinLogoTitle);
}, }
handleClick: function () {
handleClick() {
window.open(webSiteRootURL, '_blank'); window.open(webSiteRootURL, '_blank');
} }
}); }
videojs.registerComponent('Logo', Logo); videojs.registerComponent('Logo', Logo);
if (player.getChild('controlBar').getChild('PictureInPictureToggle')) { if (player.getChild('controlBar').getChild('PictureInPictureToggle')) {
@ -20,4 +20,4 @@ $(document).ready(function () {
} else { } else {
player.getChild('controlBar').addChild('Logo', {}, getPlayerButtonIndex('fullscreenToggle') - 1); player.getChild('controlBar').addChild('Logo', {}, getPlayerButtonIndex('fullscreenToggle') - 1);
} }
}); });

View file

@ -1,9 +1,8 @@
var Button = videojs.getComponent('Button'); var Button = videojs.getComponent('Button');
var LoopButton = videojs.extend(Button, { class LoopButton extends Button {
//constructor: function(player, options) { constructor() {
constructor: function () { super(...arguments);
Button.apply(this, arguments);
this.addClass('loop-button'); this.addClass('loop-button');
if (!isPlayerLoop()) { if (!isPlayerLoop()) {
this.addClass('loop-disabled-button'); this.addClass('loop-disabled-button');
@ -11,11 +10,11 @@ var LoopButton = videojs.extend(Button, {
this.addClass('fa-spin'); this.addClass('fa-spin');
} }
this.controlText("Loop"); this.controlText("Loop");
}, }
handleClick: function () { handleClick() {
tooglePlayerLoop(); tooglePlayerLoop();
} }
}); }
videojs.registerComponent('LoopButton', LoopButton); videojs.registerComponent('LoopButton', LoopButton);
player.getChild('controlBar').addChild('LoopButton', {}, 0); player.getChild('controlBar').addChild('LoopButton', {}, 0);

View file

@ -1,18 +1,18 @@
var Button = videojs.getComponent('Button'); var Button = videojs.getComponent('Button');
var socialButton = videojs.extend(Button, { class SocialButton extends Button {
//constructor: function(player, options) { constructor() {
constructor: function () { super(...arguments);
Button.apply(this, arguments);
this.addClass('social-button'); this.addClass('social-button');
this.controlText("social"); this.controlText("social");
setTimeout(function(){avideoTooltip(".social-button","Share");},1000); setTimeout(function(){avideoTooltip(".social-button","Share");},1000);
}, }
handleClick: function () {
handleClick() {
console.log('socialButton clicked'); console.log('socialButton clicked');
tooglePlayersocial(); tooglePlayersocial();
} }
}); }
videojs.registerComponent('socialButton', socialButton); videojs.registerComponent('SocialButton', SocialButton);
player.getChild('controlBar').addChild('socialButton', {}, getPlayerButtonIndex('fullscreenToggle') - 1); player.getChild('controlBar').addChild('SocialButton', {}, getPlayerButtonIndex('fullscreenToggle') - 1);

View file

@ -1,10 +1,10 @@
$(document).ready(function () { $(document).ready(function () {
var Button = videojs.getComponent('Button'); var Button = videojs.getComponent('Button');
var Theater = videojs.extend(Button, {
//constructor: function(player, options) { class Theater extends Button {
constructor: function () { constructor() {
Button.apply(this, arguments); super(...arguments);
if(isCompressed){ if(isCompressed){
this.addClass('ypt-expand'); this.addClass('ypt-expand');
this.controlText("Switch to Compressed Mode"); this.controlText("Switch to Compressed Mode");
@ -16,14 +16,13 @@ var Theater = videojs.extend(Button, {
this.addClass('hidden-sm'); this.addClass('hidden-sm');
this.addClass('hidden-xs'); this.addClass('hidden-xs');
$(this).attr('id', 'avideoTheaterButton'); $(this).attr('id', 'avideoTheaterButton');
}, }
handleClick: function () {
handleClick() {
toogleEC(); toogleEC();
} }
}); }
// Register the new component and set the right location as FF is not having a PIP button. // Register the new component and set the right location as FF is not having a PIP button.
videojs.registerComponent('Theater', Theater); videojs.registerComponent('Theater', Theater);
}); });

View file

@ -118,6 +118,6 @@
} }
}; };
vjs.plugin("persistvolume", volumePersister); vjs.registerPlugin("persistvolume", volumePersister);
}); });