1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 19:42:38 +02:00
This commit is contained in:
Daniel Neto 2023-10-30 10:02:59 -03:00
parent 403bd8125d
commit 3ab4539834
4 changed files with 97 additions and 66 deletions

View file

@ -44,8 +44,6 @@ worker_processes 1;
# record_notify on; # record_notify on;
# record_max_size 2048M; # record_max_size 2048M;
# record_suffix -%d-%b-%y-%T.flv; # record_suffix -%d-%b-%y-%T.flv;
###If live-stream is over 30FPS and you want to limit it to 30FPS recording to light the encoding task #record_max_frames 30;
# ## record_max_frames 30;
#} #}
### Record Audio Separately ( For podcast ) ### Record Audio Separately ( For podcast )

View file

@ -17,10 +17,7 @@ if ($t['id'] > 0) {
} }
$posterURL = LiveLinks::getImage($t['id']); $posterURL = LiveLinks::getImage($t['id']);
$disableYoutubeIntegration = false; $disableYoutubeIntegration = !PlayerSkins::isYoutubeIntegrationEnabled();
if (!empty($advancedCustom->disableYoutubePlayerIntegration) || isMobile()) {
$disableYoutubeIntegration = true;
}
$video['videoLink'] = $liveLink; $video['videoLink'] = $liveLink;
if (isValidM3U8Link($liveLink)) { if (isValidM3U8Link($liveLink)) {

View file

@ -3,11 +3,13 @@
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php'; require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
require_once $global['systemRootPath'] . 'plugin/AVideoPlugin.php'; require_once $global['systemRootPath'] . 'plugin/AVideoPlugin.php';
class PlayerSkins extends PluginAbstract { class PlayerSkins extends PluginAbstract
{
static public $hasMarks = false; static public $hasMarks = false;
public function getTags() { public function getTags()
{
return array( return array(
PluginTags::$FREE, PluginTags::$FREE,
PluginTags::$PLAYER, PluginTags::$PLAYER,
@ -15,7 +17,8 @@ class PlayerSkins extends PluginAbstract {
); );
} }
public function getDescription() { public function getDescription()
{
global $global; global $global;
$desc = "Customize your playes Skin<br>The Skis options are: "; $desc = "Customize your playes Skin<br>The Skis options are: ";
$dir = $global['systemRootPath'] . 'plugin/PlayerSkins/skins/'; $dir = $global['systemRootPath'] . 'plugin/PlayerSkins/skins/';
@ -32,19 +35,23 @@ class PlayerSkins extends PluginAbstract {
return $desc; return $desc;
} }
public function getName() { public function getName()
{
return "PlayerSkins"; return "PlayerSkins";
} }
public function getUUID() { public function getUUID()
{
return "e9a568e6-ef61-4dcc-aad0-0109e9be8e36"; return "e9a568e6-ef61-4dcc-aad0-0109e9be8e36";
} }
public function getPluginVersion() { public function getPluginVersion()
{
return "1.1"; return "1.1";
} }
public function getEmptyDataObject() { public function getEmptyDataObject()
{
global $global; global $global;
$obj = new stdClass(); $obj = new stdClass();
$obj->skin = "avideo"; $obj->skin = "avideo";
@ -75,7 +82,8 @@ class PlayerSkins extends PluginAbstract {
return $obj; return $obj;
} }
static function getPlaysinline() { static function getPlaysinline()
{
$obj = AVideoPlugin::getObjectData('PlayerSkins'); $obj = AVideoPlugin::getObjectData('PlayerSkins');
if ($obj->playsinline) { if ($obj->playsinline) {
return ' playsinline webkit-playsinline="webkit-playsinline" '; return ' playsinline webkit-playsinline="webkit-playsinline" ';
@ -83,7 +91,21 @@ class PlayerSkins extends PluginAbstract {
return ''; return '';
} }
static function getMediaTag($filename, $htmlMediaTag = false) { static function isYoutubeIntegrationEnabled()
{
global $advancedCustom;
if (isMobile()) {
return false;
}
if (empty($advancedCustom)) {
$advancedCustom = AVideoPlugin::loadPlugin("CustomizeAdvanced");
}
return empty($advancedCustom->disableYoutubePlayerIntegration);
}
static function getMediaTag($filename, $htmlMediaTag = false)
{
global $autoPlayURL, $global, $config, $isVideoTypeEmbed, $advancedCustom; global $autoPlayURL, $global, $config, $isVideoTypeEmbed, $advancedCustom;
$obj = AVideoPlugin::getObjectData('PlayerSkins'); $obj = AVideoPlugin::getObjectData('PlayerSkins');
$html = ''; $html = '';
@ -105,7 +127,7 @@ class PlayerSkins extends PluginAbstract {
$images = Video::getImageFromFilename($filename); $images = Video::getImageFromFilename($filename);
if ($vType == 'video') { if ($vType == 'video') {
$htmlMediaTag = '<video ' . self::getPlaysinline() $htmlMediaTag = '<video ' . self::getPlaysinline()
. 'preload="auto" poster="' . $images->poster . '" controls controlsList="nodownload" . 'preload="auto" poster="' . $images->poster . '" controls controlsList="nodownload"
class="embed-responsive-item video-js vjs-default-skin vjs-big-play-centered vjs-16-9" id="mainVideo">'; class="embed-responsive-item video-js vjs-default-skin vjs-big-play-centered vjs-16-9" id="mainVideo">';
if ($video['type'] == "video") { if ($video['type'] == "video") {
$htmlMediaTag .= "<!-- Video {$video['title']} {$video['filename']} -->" . getSources($video['filename']); $htmlMediaTag .= "<!-- Video {$video['title']} {$video['filename']} -->" . getSources($video['filename']);
@ -133,17 +155,14 @@ class PlayerSkins extends PluginAbstract {
} }
$htmlMediaTag .= '</audio>'; $htmlMediaTag .= '</audio>';
} else if ($vType == 'embed') { } else if ($vType == 'embed') {
$disableYoutubeIntegration = false; $disableYoutubeIntegration = !PlayerSkins::isYoutubeIntegrationEnabled();
if (!empty($advancedCustom->disableYoutubePlayerIntegration) || isMobile()) {
$disableYoutubeIntegration = true;
}
$_GET['isEmbedded'] = ""; $_GET['isEmbedded'] = "";
if ( if (
($disableYoutubeIntegration) || ($disableYoutubeIntegration) ||
( (
(strpos($video['videoLink'], "youtu.be") == false) && (strpos($video['videoLink'], "youtube.com") == false) (strpos($video['videoLink'], "youtu.be") == false) && (strpos($video['videoLink'], "youtube.com") == false)
//&& (strpos($video['videoLink'], "vimeo.com") == false) //&& (strpos($video['videoLink'], "vimeo.com") == false)
) )
) { ) {
$_GET['isEmbedded'] = "e"; $_GET['isEmbedded'] = "e";
$isVideoTypeEmbed = 1; $isVideoTypeEmbed = 1;
@ -216,7 +235,8 @@ class PlayerSkins extends PluginAbstract {
return $html; return $html;
} }
public function getHeadCode() { public function getHeadCode()
{
if (isWebRTC()) { if (isWebRTC()) {
return ''; return '';
} }
@ -249,7 +269,7 @@ class PlayerSkins extends PluginAbstract {
if ($obj->showLogoOnEmbed && isEmbed() || $obj->showLogo) { if ($obj->showLogoOnEmbed && isEmbed() || $obj->showLogo) {
$logo = "{$global['webSiteRootURL']}" . $config->getLogo(true); $logo = "{$global['webSiteRootURL']}" . $config->getLogo(true);
$css .= "<style>" $css .= "<style>"
. ".player-logo{ . ".player-logo{
outline: none; outline: none;
filter: grayscale(100%); filter: grayscale(100%);
width:100px !important; width:100px !important;
@ -268,7 +288,7 @@ class PlayerSkins extends PluginAbstract {
top:{$obj->showLogoAdjustTop}; top:{$obj->showLogoAdjustTop};
}" }"
. "</style>"; . "</style>";
} }
if ($obj->showShareSocial && CustomizeUser::canShareVideosFromVideo(@$video['id'])) { if ($obj->showShareSocial && CustomizeUser::canShareVideosFromVideo(@$video['id'])) {
@ -290,12 +310,14 @@ class PlayerSkins extends PluginAbstract {
return $js . $css . $oembed; return $js . $css . $oembed;
} }
static function showAutoplay() { static function showAutoplay()
{
$obj = AVideoPlugin::getDataObject('PlayerSkins'); $obj = AVideoPlugin::getDataObject('PlayerSkins');
return !isLive() && $obj->showShareAutoplay && isVideoPlayerHasProgressBar() && empty($obj->forceAlwaysAutoplay) && empty($_REQUEST['hideAutoplaySwitch']); return !isLive() && $obj->showShareAutoplay && isVideoPlayerHasProgressBar() && empty($obj->forceAlwaysAutoplay) && empty($_REQUEST['hideAutoplaySwitch']);
} }
public function getStart() { public function getStart()
{
global $global; global $global;
/* /*
if (!isBot()) { if (!isBot()) {
@ -308,7 +330,8 @@ class PlayerSkins extends PluginAbstract {
*/ */
} }
public function getFooterCode() { public function getFooterCode()
{
if (isWebRTC()) { if (isWebRTC()) {
return ''; return '';
} }
@ -319,11 +342,12 @@ class PlayerSkins extends PluginAbstract {
$js .= "<script>$(document).ready(function () {enableAutoPlay();});</script>"; $js .= "<script>$(document).ready(function () {enableAutoPlay();});</script>";
} }
if ( if (
!empty($_GET['videoName']) || !empty($_GET['videoName']) ||
!empty($_GET['u']) || !empty($_GET['u']) ||
!empty($_GET['evideo']) || !empty($_GET['evideo']) ||
!empty($_GET['playlists_id']) || !empty($_GET['playlists_id']) ||
(is_array($video) && !empty($video['id']))) { (is_array($video) && !empty($video['id']))
) {
if (empty($obj->showLoopButton) && empty($obj->contextMenuLoop)) { if (empty($obj->showLoopButton) && empty($obj->contextMenuLoop)) {
$js .= "<script>setPlayerLoop(false);</script>"; $js .= "<script>setPlayerLoop(false);</script>";
} }
@ -403,7 +427,8 @@ class PlayerSkins extends PluginAbstract {
return $js; return $js;
} }
static function getDataSetup($str = "") { static function getDataSetup($str = "")
{
global $video, $disableYoutubeIntegration, $global; global $video, $disableYoutubeIntegration, $global;
$obj = AVideoPlugin::getObjectData('PlayerSkins'); $obj = AVideoPlugin::getObjectData('PlayerSkins');
@ -441,7 +466,8 @@ class PlayerSkins extends PluginAbstract {
} }
// this function was modified, maybe removed in the future // this function was modified, maybe removed in the future
static function getStartPlayerJS($onPlayerReady = "", $getDataSetup = "", $noReadyFunction = false) { static function getStartPlayerJS($onPlayerReady = "", $getDataSetup = "", $noReadyFunction = false)
{
global $prepareStartPlayerJS_onPlayerReady, $prepareStartPlayerJS_getDataSetup; global $prepareStartPlayerJS_onPlayerReady, $prepareStartPlayerJS_getDataSetup;
global $getStartPlayerJSWasRequested; global $getStartPlayerJSWasRequested;
self::prepareStartPlayerJS($onPlayerReady, $getDataSetup); self::prepareStartPlayerJS($onPlayerReady, $getDataSetup);
@ -451,11 +477,13 @@ class PlayerSkins extends PluginAbstract {
return '/* getStartPlayerJS $prepareStartPlayerJS_onPlayerReady = "' . count($prepareStartPlayerJS_onPlayerReady) . '", $prepareStartPlayerJS_getDataSetup = "' . count($prepareStartPlayerJS_getDataSetup) . '" */'; return '/* getStartPlayerJS $prepareStartPlayerJS_onPlayerReady = "' . count($prepareStartPlayerJS_onPlayerReady) . '", $prepareStartPlayerJS_getDataSetup = "' . count($prepareStartPlayerJS_getDataSetup) . '" */';
} }
static function addOnPlayerReady($onPlayerReady) { static function addOnPlayerReady($onPlayerReady)
{
return self::getStartPlayerJS($onPlayerReady); return self::getStartPlayerJS($onPlayerReady);
} }
static function getStartPlayerJSCode($noReadyFunction = false, $currentTime = 0) { static function getStartPlayerJSCode($noReadyFunction = false, $currentTime = 0)
{
if (isWebRTC()) { if (isWebRTC()) {
return ''; return '';
} }
@ -480,7 +508,7 @@ class PlayerSkins extends PluginAbstract {
$js .= "var originalVideo;"; $js .= "var originalVideo;";
$js .= "var currentTime = $currentTime;"; $js .= "var currentTime = $currentTime;";
$js .= "var adTagOptions = {};"; $js .= "var adTagOptions = {};";
$js .= "var _adTagUrl = '{$IMAADTag}'; var player; "; $js .= "var _adTagUrl = '{$IMAADTag}'; var player; ";
$js .= "var startEvent = 'click';"; $js .= "var startEvent = 'click';";
} }
$js .= "$(document).ready(function () {"; $js .= "$(document).ready(function () {";
@ -499,27 +527,27 @@ class PlayerSkins extends PluginAbstract {
'forceNonLinearFullSlot' => true, 'forceNonLinearFullSlot' => true,
'adLabel' => __('Advertisement'), 'adLabel' => __('Advertisement'),
// 'autoPlayAdBreaks' => false, // 'autoPlayAdBreaks' => false,
); );
$js .= PHP_EOL."adTagOptions = " . json_encode($adTagOptions) . ";".PHP_EOL; $js .= PHP_EOL . "adTagOptions = " . json_encode($adTagOptions) . ";" . PHP_EOL;
$js .= "player.ima(adTagOptions);"; $js .= "player.ima(adTagOptions);";
if (isMobile()) { if (isMobile()) {
$js .= file_get_contents($global['systemRootPath'].'plugin/PlayerSkins/events/playerAdsEventsMobile.js').PHP_EOL; $js .= file_get_contents($global['systemRootPath'] . 'plugin/PlayerSkins/events/playerAdsEventsMobile.js') . PHP_EOL;
} }
$js .= file_get_contents($global['systemRootPath'].'plugin/PlayerSkins/events/playerAdsEvents.js').PHP_EOL; $js .= file_get_contents($global['systemRootPath'] . 'plugin/PlayerSkins/events/playerAdsEvents.js') . PHP_EOL;
} }
$js .= "};".PHP_EOL; $js .= "};" . PHP_EOL;
$js .= PHP_EOL."if(typeof player !== 'undefined'){"; $js .= PHP_EOL . "if(typeof player !== 'undefined'){";
$js .= file_get_contents($global['systemRootPath'].'plugin/PlayerSkins/events/playerReady.js'); $js .= file_get_contents($global['systemRootPath'] . 'plugin/PlayerSkins/events/playerReady.js');
// this is here because for some reason videos on the storage only works if it loads dinamically on android devices only // this is here because for some reason videos on the storage only works if it loads dinamically on android devices only
if (isMobile()) { if (isMobile()) {
$js .= file_get_contents($global['systemRootPath'].'plugin/PlayerSkins/events/playerReadyMobile.js'); $js .= file_get_contents($global['systemRootPath'] . 'plugin/PlayerSkins/events/playerReadyMobile.js');
} }
if (empty($_REQUEST['mute'])) { if (empty($_REQUEST['mute'])) {
$js .= file_get_contents($global['systemRootPath'].'plugin/PlayerSkins/events/playerReadyUnmuted.js'); $js .= file_get_contents($global['systemRootPath'] . 'plugin/PlayerSkins/events/playerReadyUnmuted.js');
} else { } else {
$js .= file_get_contents($global['systemRootPath'].'plugin/PlayerSkins/events/playerReadyMuted.js'); $js .= file_get_contents($global['systemRootPath'] . 'plugin/PlayerSkins/events/playerReadyMuted.js');
} }
$js .= "player.ready(function () {"; $js .= "player.ready(function () {";
@ -536,14 +564,15 @@ class PlayerSkins extends PluginAbstract {
$js .= file_get_contents($global['systemRootPath'] . 'plugin/PlayerSkins/fixCurrentSources.js'); $js .= file_get_contents($global['systemRootPath'] . 'plugin/PlayerSkins/fixCurrentSources.js');
$js .= "}"; $js .= "}";
$js .= "});"; $js .= "});";
//var_dump('getStartPlayerJSWasRequested', debug_backtrace()); //var_dump('getStartPlayerJSWasRequested', debug_backtrace());
$getStartPlayerJSWasRequested = true; $getStartPlayerJSWasRequested = true;
return $js; return $js;
} }
static private function getCurrentTime() { static private function getCurrentTime()
{
$currentTime = 0; $currentTime = 0;
if (isset($_GET['t'])) { if (isset($_GET['t'])) {
$currentTime = intval($_GET['t']); $currentTime = intval($_GET['t']);
@ -575,12 +604,14 @@ class PlayerSkins extends PluginAbstract {
return $currentTime; return $currentTime;
} }
static function setIMAADTag($tag) { static function setIMAADTag($tag)
{
global $IMAADTag; global $IMAADTag;
$IMAADTag = $tag; $IMAADTag = $tag;
} }
static function playerJSCodeOnLoad($videos_id, $nextURL = "") { static function playerJSCodeOnLoad($videos_id, $nextURL = "")
{
$js = ""; $js = "";
$videos_id = intval($videos_id); $videos_id = intval($videos_id);
if (empty($videos_id)) { if (empty($videos_id)) {
@ -649,7 +680,8 @@ class PlayerSkins extends PluginAbstract {
return true; return true;
} }
static private function prepareStartPlayerJS($onPlayerReady = "", $getDataSetup = "") { static private function prepareStartPlayerJS($onPlayerReady = "", $getDataSetup = "")
{
global $prepareStartPlayerJS_onPlayerReady, $prepareStartPlayerJS_getDataSetup; global $prepareStartPlayerJS_onPlayerReady, $prepareStartPlayerJS_getDataSetup;
if (empty($prepareStartPlayerJS_onPlayerReady)) { if (empty($prepareStartPlayerJS_onPlayerReady)) {
@ -667,7 +699,8 @@ class PlayerSkins extends PluginAbstract {
} }
} }
static function isAutoplayEnabled() { static function isAutoplayEnabled()
{
global $config; global $config;
if (isLive()) { if (isLive()) {
return true; return true;
@ -682,11 +715,12 @@ class PlayerSkins extends PluginAbstract {
return $config->getAutoplay(); return $config->getAutoplay();
} }
public static function getVideoTags($videos_id) { public static function getVideoTags($videos_id)
{
if (empty($videos_id)) { if (empty($videos_id)) {
return array(); return array();
} }
$cacheSuffix = 'PlayeSkins_getVideoTags'; $cacheSuffix = 'PlayeSkins_getVideoTags';
$videoCache = new VideoCacheHandler('', $videos_id); $videoCache = new VideoCacheHandler('', $videos_id);
$tags = $videoCache->getCache($cacheSuffix, 0); $tags = $videoCache->getCache($cacheSuffix, 0);
@ -699,12 +733,12 @@ class PlayerSkins extends PluginAbstract {
$fileName = $video->getFilename(); $fileName = $video->getFilename();
//_error_log("getVideoTags($videos_id) $fileName ".$video->getType()); //_error_log("getVideoTags($videos_id) $fileName ".$video->getType());
$resolution = $video->getVideoHigestResolution(); $resolution = $video->getVideoHigestResolution();
if(empty($resolution)){ if (empty($resolution)) {
$resolution = Video::getHigestResolution($fileName); $resolution = Video::getHigestResolution($fileName);
if(!empty($resolution)){ if (!empty($resolution)) {
$video->setVideoHigestResolution($resolution); $video->setVideoHigestResolution($resolution);
} }
}else{ } else {
$resolution = Video::getResolutionArray($resolution); $resolution = Video::getResolutionArray($resolution);
} }
@ -732,7 +766,8 @@ class PlayerSkins extends PluginAbstract {
* @param int $width * @param int $width
* @param string $color * @param string $color
*/ */
public static function createMarker($markersList, $width = 10, $color = 'yellow') { public static function createMarker($markersList, $width = 10, $color = 'yellow')
{
global $global; global $global;
$bt = debug_backtrace(); $bt = debug_backtrace();
@ -771,14 +806,15 @@ class PlayerSkins extends PluginAbstract {
} }
} }
public function getWatchActionButton($videos_id) { public function getWatchActionButton($videos_id)
{
global $global, $video; global $global, $video;
include $global['systemRootPath'] . 'plugin/PlayerSkins/actionButton.php'; include $global['systemRootPath'] . 'plugin/PlayerSkins/actionButton.php';
} }
public function getGalleryActionButton($videos_id) { public function getGalleryActionButton($videos_id)
{
global $global; global $global;
include $global['systemRootPath'] . 'plugin/PlayerSkins/actionButtonGallery.php'; include $global['systemRootPath'] . 'plugin/PlayerSkins/actionButtonGallery.php';
} }
} }

View file

@ -1,6 +1,6 @@
<?php <?php
global $global, $advancedCustom; global $global, $advancedCustom;
$disableYoutubeIntegration = @$advancedCustom->disableYoutubePlayerIntegration || isMobile(); $disableYoutubeIntegration = !PlayerSkins::isYoutubeIntegrationEnabled();
$objPlayerSkins = AVideoPlugin::getObjectData('PlayerSkins'); $objPlayerSkins = AVideoPlugin::getObjectData('PlayerSkins');
echo "<!-- including video-js -->" . PHP_EOL; echo "<!-- including video-js -->" . PHP_EOL;
if (!empty($global['forceOldChrome']) || isOldChromeVersion()) { if (!empty($global['forceOldChrome']) || isOldChromeVersion()) {