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

New fixes regarding playlists/programs

This commit is contained in:
DanielnetoDotCom 2021-02-24 20:28:58 -03:00
parent 890a14d244
commit cf40c80c16
9 changed files with 583 additions and 191 deletions

View file

@ -67,11 +67,13 @@ class AdsForJesus extends PluginAbstract {
if (!empty($videos_id)) { if (!empty($videos_id)) {
$showAds = AVideoPlugin::showAds($videos_id); $showAds = AVideoPlugin::showAds($videos_id);
if (!$showAds) { if (!$showAds) {
return ""; return "<!-- AdsForJesus::getHeadCode not show ads [{$videos_id}] -->";
} }
global $global; global $global;
$css .= '<link href="' . $global['webSiteRootURL'] . 'plugin/AD_Server/videojs-ima/videojs.ima.css" rel="stylesheet" type="text/css"/>'; $css .= '<link href="' . $global['webSiteRootURL'] . 'plugin/AD_Server/videojs-ima/videojs.ima.css" rel="stylesheet" type="text/css"/>';
$css .= '<style>.ima-ad-container{z-index:1000 !important;}</style>'; $css .= '<style>.ima-ad-container{z-index:1000 !important;}</style>';
}else{
$css .= "<!-- AdsForJesus::getHeadCode empty videos_id -->";
} }
return $js . $css; return $js . $css;
} }
@ -88,10 +90,10 @@ class AdsForJesus extends PluginAbstract {
if (!empty($videos_id)) { if (!empty($videos_id)) {
$showAds = AVideoPlugin::showAds($videos_id); $showAds = AVideoPlugin::showAds($videos_id);
if (!$showAds) { if (!$showAds) {
return ""; return "<!-- AdsForJesus::afterVideoJS not show ads [{$videos_id}] -->";
} }
if (empty($_GET['u'])) { if (empty($_GET['u'])) {
$video = Video::getVideoFromCleanTitle($_GET['videoName']); $video = Video::getVideoLight($videos_id);
$showAds = AVideoPlugin::showAds($video['id']); $showAds = AVideoPlugin::showAds($video['id']);
if (!$showAds) { if (!$showAds) {
return ""; return "";
@ -104,6 +106,8 @@ class AdsForJesus extends PluginAbstract {
$video_length = parseDurationToSeconds($video['duration']); $video_length = parseDurationToSeconds($video['duration']);
$obj = $this->getDataObject(); $obj = $this->getDataObject();
PlayerSkins::setIMAADTag("https://forjesus.tv/vmap.xml?video_durarion={$video_length}&start={$obj->start}&mid25Percent={$obj->mid25Percent}&mid50Percent={$obj->mid50Percent}&mid75Percent={$obj->mid75Percent}&end={$obj->end}"); PlayerSkins::setIMAADTag("https://forjesus.tv/vmap.xml?video_durarion={$video_length}&start={$obj->start}&mid25Percent={$obj->mid25Percent}&mid50Percent={$obj->mid50Percent}&mid75Percent={$obj->mid75Percent}&end={$obj->end}");
}else{
$js .= "<!-- AdsForJesus::getHeadCode empty videos_id -->";
} }
return $js; return $js;

View file

@ -84,9 +84,9 @@ if (empty($playListData)) {
$url = PlayLists::getLink($pl->getId()); $url = PlayLists::getLink($pl->getId());
$title = $pl->getName(); $title = $pl->getName();
if($serie = PlayLists::isPlayListASerie($pl->getId())){ if ($serie = PlayLists::isPlayListASerie($pl->getId())) {
setVideos_id($serie['id']); setVideos_id($serie['id']);
}else if(!empty($playList[$playlist_index])){ } else if (!empty($playList[$playlist_index])) {
setVideos_id($playList[$playlist_index]['id']); setVideos_id($playList[$playlist_index]['id']);
} }
//var_dump($playListData);exit; //var_dump($playListData);exit;
@ -246,36 +246,45 @@ if($serie = PlayLists::isPlayListASerie($pl->getId())){
<script src="<?php echo $global['webSiteRootURL']; ?>plugin/PlayLists/videojs-playlist-ui/videojs-playlist-ui.js"></script> <script src="<?php echo $global['webSiteRootURL']; ?>plugin/PlayLists/videojs-playlist-ui/videojs-playlist-ui.js"></script>
<script> <script>
var playerPlaylist = <?php echo json_encode($playListData); ?>; var embed_playerPlaylist = <?php echo json_encode($playListData); ?>;
var originalPlayerPlaylist = playerPlaylist; var originalPlayerPlaylist = embed_playerPlaylist;
var updatePLSourcesTimeout; var updatePLSourcesTimeout;
function updatePLSources(_index){ function updatePLSources(_index) {
if(_index<0){
_index = 0;
}
clearTimeout(updatePLSourcesTimeout); clearTimeout(updatePLSourcesTimeout);
if (typeof player.updateSrc == 'function' && playerPlaylist[_index].sources != 'undefined') { if (typeof player.updateSrc == 'function' && typeof player.videoJsResolutionSwitcher != 'undefined' && typeof embed_playerPlaylist[_index] != 'undefined' && typeof embed_playerPlaylist[_index].sources != 'undefined') {
player.updateSrc(playerPlaylist[_index].sources); console.log('updatePLSources', _index);
}else{
//player.src(embed_playerPlaylist[_index].sources);
player.updateSrc(embed_playerPlaylist[_index].sources);
//player.currentResolution(embed_playerPlaylist[_index].sources[0].label);
//player.currentResolution(embed_playerPlaylist[_index].sources[0].label);
//player.updateSrc(embed_playerPlaylist[_index].sources);
userIsControling = false;
if (typeof player.ima != 'undefined') {
console.log('updatePLSources ADs reloaded');
player.ima.requestAds();
} else {
console.log('updatePLSources player.ima is undefined');
}
if (typeof embed_playerPlaylist[_index] !== 'undefined') {
playerPlay(embed_playerPlaylist[_index].videoStartSeconds);
}
} else {
updatePLSourcesTimeout = setTimeout(function () { updatePLSourcesTimeout = setTimeout(function () {
updatePLSources(_index); updatePLSources(_index);
}, 500); }, 500);
return false; return false;
} }
setTimeout(function () {
userIsControling = false;
if(typeof player.ima != 'undefined'){
console.log('updatePLSources ADs reloaded');
player.ima.requestAds();
}
if (typeof playerPlaylist[index] !== 'undefined') {
playerPlay(playerPlaylist[index].videoStartSeconds);
}
}, 500);
} }
<?php <?php
$str = "player.playlist(playerPlaylist); $str = "player.playlist(embed_playerPlaylist);
player.playlist.autoadvance(0); player.playlist.autoadvance(0);
player.on('play', function () { player.on('play', function () {
addView(playerPlaylist[player.playlist.currentIndex()].videos_id, 0); addView(embed_playerPlaylist[player.playlist.currentIndex()].videos_id, 0);
}); });
player.on('playlistchange', function() { player.on('playlistchange', function() {
console.log('event playlistchange'); console.log('event playlistchange');
@ -284,21 +293,19 @@ $str = "player.playlist(playerPlaylist);
console.log('event duringplaylistchange'); console.log('event duringplaylistchange');
}); });
player.on('playlistitem', function() { player.on('playlistitem', function() {
console.log('event playlistitem'); var index = player.playlist.currentIndex();
var t = $(this); console.log('event playlistitem '+index);
index = t.index();
updatePLSources(index); updatePLSources(index);
}); });
player.playlistUi();"; player.playlistUi();";
if (!empty($playlist_index)) { if (!empty($playlist_index)) {
$str .= 'player.playlist.currentItem(' . $playlist_index . ');'; $str .= 'player.playlist.currentItem(' . $playlist_index . ');';
} }
$str .= "if (typeof playerPlaylist[0] !== 'undefined') { $str .= "if (typeof embed_playerPlaylist[0] !== 'undefined') {
updatePLSources({$playlist_index}); updatePLSources({$playlist_index});
} }
$('.vjs-playlist-item ').click(function () { $('.vjs-playlist-item ').click(function () {
var t = $(this); var index = player.playlist.currentIndex();
index = t.index();
updatePLSources(index); updatePLSources(index);
});"; });";
PlayerSkins::getStartPlayerJS($str); PlayerSkins::getStartPlayerJS($str);
@ -323,7 +330,7 @@ PlayerSkins::getStartPlayerJS($str);
$('#embededSortBy').change(function () { $('#embededSortBy').change(function () {
var value = $(this).val(); var value = $(this).val();
playerPlaylist.sort(function (a, b) { embed_playerPlaylist.sort(function (a, b) {
return compare(a, b, value); return compare(a, b, value);
}); });
player.playlist.sort(function (a, b) { player.playlist.sort(function (a, b) {

View file

@ -11,6 +11,13 @@ if (!PlayList::canSee($_GET['playlists_id'], User::getId())) {
die('{"error":"' . __("Permission denied") . '"}'); die('{"error":"' . __("Permission denied") . '"}');
} }
$video = PlayLists::isPlayListASerie($_GET['playlists_id']);
if(!empty($video)){
$video = Video::getVideo($video['id']);
include $global['systemRootPath'] . 'view/modeYoutube.php';
exit;
}
$playListObj = new PlayList($_GET['playlists_id']); $playListObj = new PlayList($_GET['playlists_id']);
$playList = PlayList::getVideosFromPlaylist($_GET['playlists_id']); $playList = PlayList::getVideosFromPlaylist($_GET['playlists_id']);
@ -33,7 +40,7 @@ foreach ($playList as $value) {
$playListSources = array(); $playListSources = array();
foreach ($sources as $value2) { foreach ($sources as $value2) {
if ($value2['type'] !== 'video' && $value2['type'] !== 'audio') { if ($value2['type'] !== 'video' && $value2['type'] !== 'audio' && $value2['type'] !== 'serie') {
continue; continue;
} }
$playListSources[] = new playListSource($value2['url'], $value['type'] === 'embed'); $playListSources[] = new playListSource($value2['url'], $value['type'] === 'embed');
@ -300,7 +307,7 @@ if (!empty($video['id'])) {
setTimeout(function () { setTimeout(function () {
player.currentTime(playerPlaylist[index].videoStartSeconds); player.currentTime(playerPlaylist[index].videoStartSeconds);
}, 500); }, 500);
if(typeof enableDownloadProtection === 'function'){ if (typeof enableDownloadProtection === 'function') {
enableDownloadProtection(); enableDownloadProtection();
} }
}); });

View file

@ -0,0 +1,360 @@
<?php
if (!isset($global['systemRootPath'])) {
require_once '../../videos/configuration.php';
}
$isSerie = 1;
$isPlayList = true;
require_once $global['systemRootPath'] . 'objects/playlist.php';
require_once $global['systemRootPath'] . 'plugin/PlayLists/PlayListElement.php';
if (!PlayList::canSee($_GET['playlists_id'], User::getId())) {
die('{"error":"' . __("Permission denied") . '"}');
}
$playListObj = new PlayList($_GET['playlists_id']);
$playList = PlayList::getVideosFromPlaylist($_GET['playlists_id']);
$playListData = array();
$videoStartSeconds = array();
foreach ($playList as $value) {
if ($value['type'] === 'embed') {
$sources[0]['type'] = 'video';
$sources[0]['url'] = $value["videoLink"];
} else {
$sources = getVideosURL($value['filename']);
}
$images = Video::getImageFromFilename($value['filename'], $value['type']);
$externalOptions = json_decode($value['externalOptions']);
$src = new stdClass();
$src->src = $images->thumbsJpg;
$thumbnail = array($src);
$playListSources = array();
foreach ($sources as $value2) {
if ($value2['type'] !== 'video' && $value2['type'] !== 'audio' && $value2['type'] !== 'serie') {
continue;
}
$playListSources[] = new playListSource($value2['url'], $value['type'] === 'embed');
}
if (empty($playListSources)) {
continue;
}
$playListData[] = new PlayListElement($value['title'], $value['description'], $value['duration'], $playListSources, $thumbnail, $images->poster, parseDurationToSeconds(@$externalOptions->videoStartSeconds), $value['cre'], $value['likes'], $value['views_count'], $value['videos_id']);
}
$video = PlayLists::isPlayListASerie($_GET['playlists_id']);
if (!empty($video['id'])) {
AVideoPlugin::getEmbed($video['id']);
}
?>
<!DOCTYPE html>
<html lang="<?php echo $_SESSION['language']; ?>">
<head>
<title><?php echo $playListObj->getName() . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/video.js/video-js.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>view/css/player.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>view/css/social.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>plugin/PlayLists/videojs-playlist-ui/videojs-playlist-ui.css" rel="stylesheet">
<?php include $global['systemRootPath'] . 'view/include/head.php'; ?>
<style>
.next-button:before {
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
line-height: 1;
content: "\f051";
font-family: 'Font Awesome 5 Free';
font-weight: 900;
}
.video-js .next-button {width: 2em !important;}
</style>
<?php
if (!empty($video['id'])) {
getLdJson($video['id']);
getItemprop($video['id']);
}
?>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php include $global['systemRootPath'] . 'view/include/navbar.php'; ?>
<?php
if (!empty($advancedCustomUser->showChannelBannerOnModeYoutube)) {
?>
<div class="container" style="margin-bottom: 10px;">
<img src="<?php echo User::getBackground($video['users_id']); ?>" class="img img-responsive" />
</div>
<?php
}
?>
<div class="container-fluid principalContainer">
<?php
if (!empty($playListObj)) {
if (!empty($advancedCustom->showAdsenseBannerOnTop)) {
?>
<style>
.compress {
top: 100px !important;
}
</style>
<div class="row">
<div class="col-lg-12 col-sm-12 col-xs-12">
<center style="margin:5px;">
<?php
echo getAdsLeaderBoardTop();
?>
</center>
</div>
</div>
<?php
}
?>
<!-- playlist player -->
<div class="row main-video" id="mvideo">
<div class="col-sm-2 col-md-2 firstC"></div>
<div class="col-sm-8 col-md-8 secC">
<div id="videoContainer">
<div id="floatButtons" style="display: none;">
<p class="btn btn-outline btn-xs move">
<i class="fas fa-expand-arrows-alt"></i>
</p>
<button type="button" class="btn btn-outline btn-xs"
onclick="closeFloatVideo(); floatClosed = 1;">
<i class="fas fa-times"></i>
</button>
</div>
<div id="main-video" class="embed-responsive embed-responsive-16by9">
<video playsinline
<?php if ($config->getAutoplay() && false) { // disable it for now ?>
autoplay="true"
muted="muted"
<?php } ?>
preload="auto"
controls class="embed-responsive-item video-js vjs-default-skin vjs-big-play-centered" id="mainVideo"
data-setup='{"techOrder": ["youtube","html5"]}'>
</video>
</div>
<?php
if (AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) {
require_once $global['systemRootPath'] . 'plugin/VideoLogoOverlay/VideoLogoOverlay.php';
$style = VideoLogoOverlay::getStyle();
$url = VideoLogoOverlay::getLink();
?>
<div style="<?php echo $style; ?>" class="VideoLogoOverlay">
<a href="<?php echo $url; ?>" target="_blank"> <img src="<?php echo $global['webSiteRootURL']; ?>videos/logoOverlay.png" alt="Logo" class="img-responsive col-lg-12 col-md-8 col-sm-7 col-xs-6"></a>
</div>
<?php } ?>
<?php
showCloseButton();
?>
</div>
</div>
<div class="col-sm-2 col-md-2"></div>
</div>
<div class="row" id="modeYoutubeBottom">
<div class="col-sm-1 col-md-1"></div>
<div class="col-sm-8 col-md-8" id="modeYoutubeBottomContent">
</div>
<div class="col-sm-2 col-md-2 bgWhite list-group-item rightBar">
<div class="col-lg-12 col-sm-12 col-xs-12">
<?php echo getAdsSideRectangle(); ?>
</div>
<input type="search" id="playListSearch" class="form-control" placeholder=" <?php echo __("Search"); ?>"/>
<select class="form-control" id="embededSortBy" >
<option value="default"> <?php echo __("Default"); ?></option>
<option value="titleAZ" data-icon="glyphicon-sort-by-attributes"> <?php echo __("Title (A-Z)"); ?></option>
<option value="titleZA" data-icon="glyphicon-sort-by-attributes-alt"> <?php echo __("Title (Z-A)"); ?></option>
<option value="newest" data-icon="glyphicon-sort-by-attributes"> <?php echo __("Date added (newest)"); ?></option>
<option value="oldest" data-icon="glyphicon-sort-by-attributes-alt" > <?php echo __("Date added (oldest)"); ?></option>
<option value="popular" data-icon="glyphicon-thumbs-up"> <?php echo __("Most popular"); ?></option>
<?php
if (empty($advancedCustom->doNotDisplayViews)) {
?>
<option value="views_count" data-icon="glyphicon-eye-open" <?php echo (!empty($_POST['sort']['views_count'])) ? "selected='selected'" : "" ?>> <?php echo __("Most watched"); ?></option>
<?php } ?>
</select>
<div class="vjs-playlist" style="" id="playList">
<!--
The contents of this element will be filled based on the
currently loaded playlist
-->
</div>
</div>
<div class="col-sm-1 col-md-1"></div>
</div>
<?php
} else {
?>
<br>
<br>
<br>
<br>
<div class="alert alert-warning">
<span class="glyphicon glyphicon-facetime-video"></span> <strong><?php echo __("Attention"); ?>!</strong> <?php echo empty($advancedCustom->videoNotFoundText->value) ? __("We have not found any videos or audios to show") : $advancedCustom->videoNotFoundText->value; ?>.
</div>
<?php } ?>
</div>
<?php
include $global['systemRootPath'] . 'view/include/video.min.js.php';
?>
<?php
echo AVideoPlugin::afterVideoJS();
include $global['systemRootPath'] . 'view/include/footer.php';
$videoJSArray = array(
"view/js/BootstrapMenu.min.js");
$jsURL = combineFiles($videoJSArray, "js");
?>
<script src="<?php echo $jsURL; ?>" type="text/javascript"></script><script src="<?php echo $global['webSiteRootURL']; ?>plugin/PlayLists/videojs-playlist/videojs-playlist.js"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>plugin/PlayLists/videojs-playlist-ui/videojs-playlist-ui.js"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/videojs-youtube/Youtube.js"></script>
<script>
var playerPlaylist = <?php echo json_encode($playListData); ?>;
var originalPlayerPlaylist = playerPlaylist;
if (typeof player === 'undefined') {
player = videojs('mainVideo'<?php echo PlayerSkins::getDataSetup(); ?>);
}
var videos_id = playerPlaylist[0].videos_id;
player.on('play', function () {
addView(videos_id, this.currentTime());
});
player.on('timeupdate', function () {
var time = Math.round(this.currentTime());
if (time >= 5 && time % 5 === 0) {
addView(videos_id, time);
}
});
player.on('ended', function () {
var time = Math.round(this.currentTime());
addView(videos_id, time);
});
player.playlist(playerPlaylist);
player.playlist.autoadvance(0);
player.playlist.repeat(true);
// Initialize the playlist-ui plugin with no option (i.e. the defaults).
player.playlistUi();
var timeout;
$(document).ready(function () {
$("#playListSearch").keyup(function () {
var filter = $(this).val();
$(".vjs-playlist-item-list li").each(function () {
if ($(this).find('.vjs-playlist-name').text().search(new RegExp(filter, "i")) < 0) {
$(this).slideUp();
} else {
$(this).slideDown();
}
});
});
$('#embededSortBy').click(function () {
setTimeout(function () {
clearTimeout(timeout);
}, 2000);
});
$('#embededSortBy').change(function () {
var value = $(this).val();
playerPlaylist.sort(function (a, b) {
return compare(a, b, value);
});
player.playlist.sort(function (a, b) {
return compare(a, b, value);
});
});
//Prevent HTML5 video from being downloaded (right-click saved)?
$('#mainVideo').bind('contextmenu', function () {
return false;
});
player.currentTime(playerPlaylist[0].videoStartSeconds);
$("#modeYoutubeBottomContent").load("<?php echo $global['webSiteRootURL']; ?>view/modeYoutubeBottom.php?videos_id=" + playerPlaylist[0].videos_id);
$(".vjs-playlist-item ").click(function () {
});
player.on('playlistitem', function () {
index = player.playlist.currentIndex();
videos_id = playerPlaylist[index].videos_id;
$("#modeYoutubeBottomContent").load("<?php echo $global['webSiteRootURL']; ?>view/modeYoutubeBottom.php?videos_id=" + playerPlaylist[index].videos_id);
setTimeout(function () {
player.currentTime(playerPlaylist[index].videoStartSeconds);
}, 500);
if (typeof enableDownloadProtection === 'function') {
enableDownloadProtection();
}
});
setTimeout(function () {
var Button = videojs.getComponent('Button');
var nextButton = videojs.extend(Button, {
//constructor: function(player, options) {
constructor: function () {
Button.apply(this, arguments);
//this.addClass('vjs-chapters-button');
this.addClass('next-button');
this.addClass('vjs-button-fa-size');
this.controlText("Next");
},
handleClick: function () {
player.playlist.next();
}
});
// Register the new component
videojs.registerComponent('nextButton', nextButton);
player.getChild('controlBar').addChild('nextButton', {}, getPlayerButtonIndex('PlayToggle') + 1);
}, 30);
});
function compare(a, b, type) {
console.log(type);
switch (type) {
case "titleAZ":
return strcasecmp(a.name, b.name);
break;
case "titleZA":
return strcasecmp(b.name, a.name);
break;
case "newest":
return a.created > b.created ? 1 : (a.created < b.created ? -1 : 0);
break;
case "oldest":
return b.created > a.created ? 1 : (b.created < a.created ? -1 : 0);
break;
case "popular":
return a.likes > b.likes ? 1 : (a.likes < b.likes ? -1 : 0);
break;
default:
return 0;
break;
}
}
function strcasecmp(s1, s2) {
s1 = (s1 + '').toLowerCase();
s2 = (s2 + '').toLowerCase();
return s1 > s2 ? 1 : (s1 < s2 ? -1 : 0);
}
</script>
</body>
</html>
<?php include $global['systemRootPath'] . 'objects/include_end.php'; ?>

View file

@ -286,11 +286,20 @@ if (!User::isLogged() && !empty($advancedCustomUser->userMustBeLoggedIn) && !emp
$("#sidebar").fadeOut(); $("#sidebar").fadeOut();
youTubeMenuIsOpened = false; youTubeMenuIsOpened = false;
} }
$(document).ready(function () {
function YPTHidenavbar(){
if(typeof inIframe == 'undefined'){
setTimeout(function(){YPTHidenavbar()},500);
}else{
if (inIframe()) { if (inIframe()) {
$("#mainNavBar").hide(); $("#mainNavBar").hide();
$("body").css("padding-top", "0"); $("body").css("padding-top", "0");
} }
}
}
$(document).ready(function () {
YPTHidenavbar();
$('#buttonMenu').on("click.sidebar", function (event) { $('#buttonMenu').on("click.sidebar", function (event) {
event.stopPropagation(); event.stopPropagation();
//$('#sidebar').fadeToggle(); //$('#sidebar').fadeToggle();

View file

@ -57,6 +57,7 @@ if (!empty($videoSerie)) {
<?php <?php
$count = 0; $count = 0;
foreach ($playlistVideos as $value) { foreach ($playlistVideos as $value) {
$value = object_to_array($value);
$class = ""; $class = "";
$indicator = $count + 1; $indicator = $count + 1;
if ($count == $playlist_index) { if ($count == $playlist_index) {
@ -81,11 +82,6 @@ if (!empty($videoSerie)) {
?> ?>
<img src="<?php echo $img; ?>" alt="<?php echo $value['title']; ?>" class="img-responsive <?php echo $img_portrait; ?> rotate<?php echo $value['rotation']; ?>" height="130" itemprop="thumbnail" /> <img src="<?php echo $img; ?>" alt="<?php echo $value['title']; ?>" class="img-responsive <?php echo $img_portrait; ?> rotate<?php echo $value['rotation']; ?>" height="130" itemprop="thumbnail" />
<span itemprop="thumbnailUrl" content="<?php echo $img; ?>" />
<span itemprop="contentURL" content="<?php echo $global['webSiteRootURL'], @$catLink, "video/", $value['clean_title']; ?>" />
<span itemprop="embedURL" content="<?php echo $global['webSiteRootURL'], "videoEmbeded/", $value['clean_title']; ?>" />
<span itemprop="uploadDate" content="<?php echo $value['created']; ?>" />
<?php <?php
if ($value['type'] !== 'pdf' && $value['type'] !== 'article' && $value['type'] !== 'serie') { if ($value['type'] !== 'pdf' && $value['type'] !== 'article' && $value['type'] !== 'serie') {
?> ?>

View file

@ -152,19 +152,21 @@ function lazyImage() {
lazyImage(); lazyImage();
var pleaseWaitIsINUse = false; var pleaseWaitIsINUse = false;
var pauseIfIsPlayinAdsInterval;
function setPlayerListners() { function setPlayerListners() {
if (typeof player !== 'undefined') { if (typeof player !== 'undefined') {
player.on('pause', function () { player.on('pause', function () {
clearTimeout(promisePlayTimeout); clearTimeout(promisePlayTimeout);
console.log("setPlayerListners: pause"); console.log("setPlayerListners: pause");
//userIsControling = true; //userIsControling = true;
clearInterval(pauseIfIsPlayinAdsInterval);
}); });
player.on('play', function () { player.on('play', function () {
clearTimeout(promisePlayTimeout); clearTimeout(promisePlayTimeout);
console.log("setPlayerListners: play"); console.log("setPlayerListners: play");
//userIsControling = true; //userIsControling = true;
pauseIfIsPlayinAdsInterval = setInterval(function(){pauseIfIsPlayinAds();},500);
}); });
$("#mainVideo .vjs-mute-control").click(function () { $("#mainVideo .vjs-mute-control").click(function () {
@ -178,7 +180,6 @@ function setPlayerListners() {
setPlayerListners(); setPlayerListners();
}, 2000); }, 2000);
} }
pauseIfIsPlayinAds();
} }
function removeTracks() { function removeTracks() {
@ -858,6 +859,9 @@ function isPlayNextEnabled() {
} }
function avideoAlert(title, msg, type) { function avideoAlert(title, msg, type) {
if(typeof msg == 'undefined'){
return false;
}
if (msg !== msg.replace(/<\/?[^>]+(>|$)/g, "")) {//it has HTML if (msg !== msg.replace(/<\/?[^>]+(>|$)/g, "")) {//it has HTML
avideoAlertHTMLText(title, msg, type); avideoAlertHTMLText(title, msg, type);
} else { } else {
@ -977,13 +981,9 @@ function playerHasAds() {
} }
function pauseIfIsPlayinAds(){ function pauseIfIsPlayinAds(){
if(playerHasAds()){ if(!player.paused() && playerHasAds() && playerIsPlayingAds()){
setTimeout(function(){
if(playerIsPlayingAds()){
player.pause(); player.pause();
} }
}, 1000);
}
} }
function countTo(selector, total) { function countTo(selector, total) {

View file

@ -73,7 +73,7 @@ if (!empty($evideo)) {
} }
$videosArrayId = PlayList::getVideosIdFromPlaylist($playlist_id); $videosArrayId = PlayList::getVideosIdFromPlaylist($playlist_id);
if(empty($videosArrayId)){ if (empty($videosArrayId)) {
videoNotFound(__('Playlist is empty or does not exist')); videoNotFound(__('Playlist is empty or does not exist'));
} }
$videosPlayList = Video::getAllVideos("viewable", false, false, $videosArrayId, false, true); $videosPlayList = Video::getAllVideos("viewable", false, false, $videosArrayId, false, true);
@ -111,6 +111,12 @@ if (!empty($evideo)) {
$autoPlayVideo = Video::getVideo($videosPlayList[0]['id'], "viewableNotUnlisted", false, false, false, true); $autoPlayVideo = Video::getVideo($videosPlayList[0]['id'], "viewableNotUnlisted", false, false, false, true);
$autoPlayVideo['url'] = $global['webSiteRootURL'] . "playlist/{$playlist_id}/0"; $autoPlayVideo['url'] = $global['webSiteRootURL'] . "playlist/{$playlist_id}/0";
} }
if ($serie = PlayLists::isPlayListASerie($playlist_id)) {
setVideos_id($serie['id']);
} else if (!empty($videosPlayList[$playlist_index])) {
setVideos_id($videosPlayList[$playlist_index]['id']);
}
} else { } else {
$catLink = ""; $catLink = "";
if (!empty($_GET['catName'])) { if (!empty($_GET['catName'])) {
@ -138,7 +144,7 @@ if (!empty($evideo)) {
if (!empty($_GET['v']) && (empty($video) || $video['id'] != $_GET['v'])) { if (!empty($_GET['v']) && (empty($video) || $video['id'] != $_GET['v'])) {
$video = false; $video = false;
} }
if(!empty($video['id'])){ if (!empty($video['id'])) {
// allow users to count a view again in case it is refreshed // allow users to count a view again in case it is refreshed
Video::unsetAddView($video['id']); Video::unsetAddView($video['id']);
@ -197,7 +203,7 @@ if (!empty($evideo)) {
*/ */
$modeYouTubeTimeLog['Code part 1.5'] = microtime(true) - $modeYouTubeTime; $modeYouTubeTimeLog['Code part 1.5'] = microtime(true) - $modeYouTubeTime;
$modeYouTubeTime = microtime(true); $modeYouTubeTime = microtime(true);
if(!empty($video['id'])){ if (!empty($video['id'])) {
$autoPlayVideo = Video::getRandom($video['id']); $autoPlayVideo = Video::getRandom($video['id']);
} }
//} //}
@ -282,11 +288,12 @@ if (!empty($evideo)) {
if (empty($_GET['videoName']) && !empty($video)) { if (empty($_GET['videoName']) && !empty($video)) {
$_GET['videoName'] = $video['clean_title']; $_GET['videoName'] = $video['clean_title'];
} }
if(!empty($_GET['videoName'])){
$v = Video::getVideoFromCleanTitle($_GET['videoName']); $v = Video::getVideoFromCleanTitle($_GET['videoName']);
if(empty($v)){ }
if (empty($v)) {
videoNotFound(""); videoNotFound("");
}else{ } else {
$modeYouTubeTimeLog['Code part 4'] = microtime(true) - $modeYouTubeTime; $modeYouTubeTimeLog['Code part 4'] = microtime(true) - $modeYouTubeTime;
$modeYouTubeTime = microtime(true); $modeYouTubeTime = microtime(true);
AVideoPlugin::getModeYouTube($v['id']); AVideoPlugin::getModeYouTube($v['id']);
@ -348,10 +355,10 @@ if (!empty($video['users_id']) && User::hasBlockedUser($video['users_id'])) {
<?php <?php
include $global['systemRootPath'] . 'view/include/head.php'; include $global['systemRootPath'] . 'view/include/head.php';
if(!empty($_GET['v'])){ if (!empty($_GET['v'])) {
getOpenGraph($_GET['v']); getOpenGraph($_GET['v']);
getLdJson($_GET['v']); getLdJson($_GET['v']);
}else{ } else {
getOpenGraph(0); getOpenGraph(0);
getLdJson(0); getLdJson(0);
} }

View file

@ -1,5 +1,7 @@
<?php <?php
require_once '../videos/configuration.php'; if(empty($global['systemRootPath'])){
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/subscribe.php'; require_once $global['systemRootPath'] . 'objects/subscribe.php';
if (empty($video) && !empty($_GET['videos_id'])) { if (empty($video) && !empty($_GET['videos_id'])) {
$video = Video::getVideo(intval($_GET['videos_id']), "viewable", true, false, true, true); $video = Video::getVideo(intval($_GET['videos_id']), "viewable", true, false, true, true);