diff --git a/plugin/PlayerSkins/PlayerSkins.php b/plugin/PlayerSkins/PlayerSkins.php
index e06cd3e87..ac2204fef 100644
--- a/plugin/PlayerSkins/PlayerSkins.php
+++ b/plugin/PlayerSkins/PlayerSkins.php
@@ -1,608 +1,615 @@
The Skis options are: ";
$dir = $global['systemRootPath'] . 'plugin/PlayerSkins/skins/';
$names = array();
foreach (glob($dir . '*.css') as $file) {
$path_parts = pathinfo($file);
$names[] = $path_parts['filename'];
}
return $desc . "" . implode(" or ", $names) . "";
}
public function getName() {
return "PlayerSkins";
}
public function getUUID() {
return "e9a568e6-ef61-4dcc-aad0-0109e9be8e36";
}
public function getPluginVersion() {
return "1.1";
}
public function getEmptyDataObject() {
global $global;
$obj = new stdClass();
$obj->skin = "avideo";
$obj->playbackRates = "[0.5, 1, 1.5, 2]";
$obj->playerCustomDataSetup = "";
$obj->showSocialShareOnEmbed = true;
$obj->showLoopButton = true;
$obj->showLogo = false;
$obj->showShareSocial = true;
$obj->showShareAutoplay = true;
$obj->showLogoOnEmbed = false;
$obj->showLogoAdjustScale = "0.4";
$obj->showLogoAdjustLeft = "-74px";
$obj->showLogoAdjustTop = "-22px;";
$obj->disableEmbedTopInfo = false;
$obj->contextMenuDisableEmbedOnly = false;
$obj->contextMenuLoop = true;
$obj->contextMenuCopyVideoURL = true;
$obj->contextMenuCopyVideoURLCurrentTime = true;
$obj->contextMenuCopyEmbedCode = true;
$obj->contextMenuShare = true;
$obj->playerFullHeight = false;
return $obj;
}
static function getMediaTag($filename, $htmlMediaTag = false) {
global $autoPlayURL, $global, $config, $isVideoTypeEmbed, $advancedCustom;
$obj = AVideoPlugin::getObjectData('PlayerSkins');
$html = '';
if (empty($htmlMediaTag)) {
$video = Video::getVideoFromFileName($filename, true);
$vType = Video::getIncludeType($video);
$_GET['isMediaPlaySite'] = $video['id'];
- if(is_object($video['externalOptions'])){
+ if (is_object($video['externalOptions'])) {
if (!empty($video['externalOptions']->videoStartSeconds)) {
$video['externalOptions']->videoStartSeconds = parseDurationToSeconds($video['externalOptions']->videoStartSeconds);
} else {
$video['externalOptions']->videoStartSeconds = 0;
}
- }else{
+ } else {
//_error_log('externalOptions Error '.$video['externalOptions'], AVideoLog::$WARNING);
$video['externalOptions'] = new stdClass();
$video['externalOptions']->videoStartSeconds = 0;
}
$images = Video::getImageFromFilename($filename);
if ($vType == 'video') {
$htmlMediaTag = '';
} else if ($vType == 'audio') {
$htmlMediaTag = '';
} else if ($vType == 'embed') {
$disableYoutubeIntegration = false;
if (!empty($advancedCustom->disableYoutubePlayerIntegration) || isMobile()) {
$disableYoutubeIntegration = true;
}
$_GET['isEmbedded'] = "";
if (($disableYoutubeIntegration) || ((strpos($video['videoLink'], "youtu.be") == false) && (strpos($video['videoLink'], "youtube.com") == false) && (strpos($video['videoLink'], "vimeo.com") == false))) {
$_GET['isEmbedded'] = "e";
$isVideoTypeEmbed = 1;
$url = parseVideos($video['videoLink']);
if ($config->getAutoplay()) {
$url = addQueryStringParameter($url, 'autoplay', 1);
}
$htmlMediaTag = "";
$htmlMediaTag .= '';
$htmlMediaTag .= '
';
$htmlMediaTag .= '';
$htmlMediaTag .= '';
$htmlMediaTag .= '
';
} else {
// youtube!
if ((stripos($video['videoLink'], "youtube.com") != false) || (stripos($video['videoLink'], "youtu.be") != false)) {
$_GET['isEmbedded'] = "y";
} else if ((stripos($video['videoLink'], "vimeo.com") != false)) {
$_GET['isEmbedded'] = "v";
}
$_GET['isMediaPlaySite'] = $video['id'];
PlayerSkins::playerJSCodeOnLoad($video['id'], @$video['url']);
$htmlMediaTag = "";
$htmlMediaTag .= '';
$htmlMediaTag .= '';
}
} else if ($vType == 'serie') {
$isVideoTypeEmbed = 1;
$link = "{$global['webSiteRootURL']}plugin/PlayLists/embed.php";
$link = addQueryStringParameter($link, 'playlists_id', $video['serie_playlists_id']);
$link = addQueryStringParameter($link, 'autoplay', $config->getAutoplay());
$link = addQueryStringParameter($link, 'playlist_index', @$_REQUEST['playlist_index']);
$htmlMediaTag = "";
$htmlMediaTag .= '';
$htmlMediaTag .= '';
$htmlMediaTag .= '';
}
-
+
$html .= "';
}
-
+
$col1Classes = 'col-md-2 firstC';
$col2Classes = 'col-md-8 secC';
$col3Classes = 'col-md-2 thirdC';
- if($obj->playerFullHeight){
+ if ($obj->playerFullHeight) {
$col2Classes .= ' text-center playerFullHeight';
}
-
+
$html .= '
-
-
+
+
' . $htmlMediaTag . '
';
- $html .= showCloseButton() . '
';
+ $html .= showCloseButton() . '
';
return $html;
}
public function getHeadCode() {
- if(isWebRTC()){
+ if (isWebRTC()) {
return '';
}
global $global, $config, $video;
$obj = $this->getDataObject();
$css = "";
$js = "";
if (isLive()) {
$js .= "";
}
if (isVideo() || !empty($_GET['videoName']) || !empty($_GET['u']) || !empty($_GET['evideo']) || !empty($_GET['playlists_id'])) {
if (self::isAutoplayEnabled()) {
$js .= "";
} else {
$js .= "";
}
$js .= "";
if (!empty($obj->skin)) {
- $css .= "skin}.css\" rel=\"stylesheet\" type=\"text/css\"/>";
+ $css .= "skin}.css\" rel=\"stylesheet\" type=\"text/css\"/>";
}
if ($obj->showLoopButton && isVideoPlayerHasProgressBar()) {
- $css .= "";
+ $css .= "";
}
- $css .= "";
- $css .= "";
+ $css .= "";
+ $css .= "";
if ($obj->showLogoOnEmbed && isEmbed() || $obj->showLogo) {
$logo = "{$global['webSiteRootURL']}" . $config->getLogo(true);
$css .= "";
}
if ($obj->showShareSocial && CustomizeUser::canShareVideosFromVideo(@$video['id'])) {
- $css .= "";
+ $css .= "";
}
if ($obj->showShareAutoplay && isVideoPlayerHasProgressBar()) {
- $css .= "";
+ $css .= "";
}
}
$url = urlencode(getSelfURI());
- $oembed = '';
- $oembed .= '';
+ $oembed = '';
+ $oembed .= '';
return $js . $css . $oembed;
}
public function getFooterCode() {
- if(isWebRTC()){
+ if (isWebRTC()) {
return '';
}
global $global, $config, $getStartPlayerJSWasRequested, $video, $url, $title;
$js = "";
$obj = $this->getDataObject();
if (!empty($_GET['videoName']) || !empty($_GET['u']) || !empty($_GET['evideo']) || !empty($_GET['playlists_id'])) {
if (empty($obj->showLoopButton) && empty($playerSkinsObj->contextMenuLoop)) {
$js .= "";
}
if ($obj->showLogoOnEmbed && isEmbed() || $obj->showLogo) {
$title = $config->getWebSiteTitle();
$url = "{$global['webSiteRootURL']}{$config->getLogo(true)}";
$js .= "";
PlayerSkins::getStartPlayerJS(file_get_contents("{$global['systemRootPath']}plugin/PlayerSkins/logo.js"));
//$js .= "";
}
if ($obj->showShareSocial && CustomizeUser::canShareVideosFromVideo(@$video['id'])) {
$social = getSocialModal(@$video['id'], @$url, @$title);
PlayerSkins::getStartPlayerJS(file_get_contents("{$global['systemRootPath']}plugin/PlayerSkins/shareButton.js"));
//$js .= "";
$js .= $social['html'];
$js .= "";
}
if ($obj->showShareAutoplay && isVideoPlayerHasProgressBar()) {
PlayerSkins::getStartPlayerJS(file_get_contents("{$global['systemRootPath']}plugin/PlayerSkins/autoplayButton.js"));
}
}
if (isAudio()) {
$videos_id = getVideos_id();
$video = Video::getVideoLight($videos_id);
$spectrumSource = Video::getSourceFile($video['filename'], "_spectrum.jpg");
if (!empty($spectrumSource["path"])) {
$onPlayerReady = "startAudioSpectrumProgress('{$spectrumSource["url"]}');";
self::prepareStartPlayerJS($onPlayerReady);
}
}
if (!empty($getStartPlayerJSWasRequested) || isVideo()) {
- $js .= "";
+ $js .= "";
$js .= "";
}
return $js;
}
static function getDataSetup($str = "") {
global $video, $disableYoutubeIntegration, $global;
$obj = AVideoPlugin::getObjectData('PlayerSkins');
$dataSetup = array();
$dataSetup[] = "errorDisplay: false";
if (isVideoPlayerHasProgressBar() && !empty($obj->playbackRates)) {
$dataSetup[] = "'playbackRates':{$obj->playbackRates}";
}
if (isVideoPlayerHasProgressBar() && (isset($_GET['isEmbedded'])) && ($disableYoutubeIntegration == false) && !empty($video['videoLink'])) {
if ($_GET['isEmbedded'] == "y") {
$dataSetup[] = "techOrder:[\"youtube\"]";
$dataSetup[] = "sources:[{type: \"video/youtube\", src: \"{$video['videoLink']}\"}]";
$dataSetup[] = "youtube:{customVars: {wmode: \"transparent\", origin: \"{$global['webSiteRootURL']}\"}}";
} else if ($_GET['isEmbedded'] == "v") {
$dataSetup[] = "techOrder:[\"vimeo\"]";
$dataSetup[] = "sources:[{type: \"video/vimeo\", src: \"{$video['videoLink']}\"}]";
$dataSetup[] = "vimeo:{customVars: {wmode: \"transparent\", origin: \"{$global['webSiteRootURL']}\"}}";
}
}
$pluginsDataSetup = AVideoPlugin::dataSetup();
if (!empty($pluginsDataSetup)) {
$dataSetup[] = $pluginsDataSetup;
}
if (!empty($dataSetup)) {
return ",{" . implode(",", $dataSetup) . "{$str}{$obj->playerCustomDataSetup}}";
}
return "";
}
// this function was modified, maybe removed in the future
static function getStartPlayerJS($onPlayerReady = "", $getDataSetup = "", $noReadyFunction = false) {
global $prepareStartPlayerJS_onPlayerReady, $prepareStartPlayerJS_getDataSetup;
global $getStartPlayerJSWasRequested;
self::prepareStartPlayerJS($onPlayerReady, $getDataSetup);
//var_dump('getStartPlayerJSWasRequested', debug_backtrace());
$getStartPlayerJSWasRequested = true;
//return '/* getStartPlayerJS $prepareStartPlayerJS_onPlayerReady = "' . count($prepareStartPlayerJS_onPlayerReady) . '", $prepareStartPlayerJS_getDataSetup = "' . count($prepareStartPlayerJS_getDataSetup) . '", $onPlayerReady = "' . $onPlayerReady . '", $getDataSetup = "' . $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);
}
static function getStartPlayerJSCode($noReadyFunction = false, $currentTime = 0) {
- if(isWebRTC()){
+ if (isWebRTC()) {
return '';
}
global $config, $global, $prepareStartPlayerJS_onPlayerReady, $prepareStartPlayerJS_getDataSetup, $IMAADTag;
$obj = AVideoPlugin::getObjectData('PlayerSkins');
$js = "";
if (empty($currentTime) && isVideoPlayerHasProgressBar()) {
$currentTime = self::getCurrentTime();
}
-
- if(!empty($global['doNotLoadPlayer'])){
+
+ if (!empty($global['doNotLoadPlayer'])) {
return '';
}
-
- if(empty($prepareStartPlayerJS_onPlayerReady)){
+
+ if (empty($prepareStartPlayerJS_onPlayerReady)) {
$prepareStartPlayerJS_onPlayerReady = array();
}
- if(empty($prepareStartPlayerJS_getDataSetup)){
+ if (empty($prepareStartPlayerJS_getDataSetup)) {
$prepareStartPlayerJS_getDataSetup = array();
}
-
+
if (empty($noReadyFunction)) {
$js .= "var originalVideo;
var adTagOptions;
var _adTagUrl = '{$IMAADTag}'; var player; "
. "$(document).ready(function () {";
}
$js .= "
originalVideo = $('#mainVideo').clone();
/* prepareStartPlayerJS_onPlayerReady = " . count($prepareStartPlayerJS_onPlayerReady) . ", prepareStartPlayerJS_getDataSetup = " . count($prepareStartPlayerJS_getDataSetup) . " */
if (typeof player === 'undefined') {
player = videojs('mainVideo'" . (self::getDataSetup(implode(" ", $prepareStartPlayerJS_getDataSetup))) . ");
";
if (!empty($IMAADTag) && isVideoPlayerHasProgressBar()) {
$js .= "adTagOptions = {id: 'mainVideo', adTagUrl: '{$IMAADTag}', autoPlayAdBreaks:false}; player.ima(adTagOptions);";
$js .= "setInterval(function(){ fixAdSize(); }, 300);
// first time it's clicked.
var startEvent = 'click';";
if (isMobile()) {
$js .= "// Remove controls from the player on iPad to stop native controls from stealing
// our click
var contentPlayer = document.getElementById('content_video_html5_api');
if (contentPlayer && (navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)) &&
contentPlayer.hasAttribute('controls')) {
contentPlayer.removeAttribute('controls');
}
// Initialize the ad container when the video player is clicked, but only the
if (navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)) {
startEvent = 'touchend';
}";
}
$js .= "
player.on('adsready', function () {
console.log('reloadAds adIsReady ');
player.ima.setAdBreakReadyListener(function() {console.log('Ads playAdBreak()');player.ima.playAdBreak();});
});player.on('ads-ad-started', function () {
console.log('ads-ad-started');
});player.on('ads-manager', function (a) {
console.log('ads-manager', a);
});player.on('ads-manager', function (a) {
console.log('ads-loader', a);
});player.on('ads-manager', function (a) {
console.log('ads-request', a);
});player.one(startEvent, function () {player.ima.initializeAdDisplayContainer();});";
}
$js .= "}
player.ready(function () {";
$js .= "var err = this.error();
if (err && err.code) {
$('.vjs-error-display').hide();
$('#mainVideo').find('.vjs-poster').css({'background-image': 'url({$global['webSiteRootURL']}plugin/Live/view/Offline.jpg)'});
}
" . implode(PHP_EOL, $prepareStartPlayerJS_onPlayerReady) . "
playerPlayIfAutoPlay({$currentTime});
});
player.persistvolume({
namespace: 'AVideo'
});";
if ($obj->showLoopButton && isVideoPlayerHasProgressBar()) {
$js .= file_get_contents($global['systemRootPath'] . 'plugin/PlayerSkins/loopbutton.js');
}
$js .= file_get_contents($global['systemRootPath'] . 'plugin/PlayerSkins/fixCurrentSources.js');
if (empty($noReadyFunction)) {
$js .= "});";
}
//var_dump('getStartPlayerJSWasRequested', debug_backtrace());
$getStartPlayerJSWasRequested = true;
return $js;
}
static private function getCurrentTime() {
- global $video;
$currentTime = 0;
if (isset($_GET['t'])) {
$currentTime = intval($_GET['t']);
- } else if (!empty($video['progress']) && !empty($video['progress']['lastVideoTime'])) {
- $currentTime = intval($video['progress']['lastVideoTime']);
- $maxCurrentTime = parseDurationToSeconds($video['duration']);
- if ($maxCurrentTime <= $currentTime + 5) {
- if (!empty($video['externalOptions']) && !empty($video['externalOptions']->videoStartSeconds)) {
- $currentTime = intval($video['externalOptions']->videoStartSeconds);
- } else {
+ } else {
+ $videos_id = getVideos_id();
+ if (!empty($videos_id)) {
+ $video = Video::getVideoLight($videos_id);
+ $progress = Video::getVideoPogressPercent($videos_id);
+ if (!empty($progress) && !empty($progress['lastVideoTime'])) {
+ $currentTime = intval($video['progress']['lastVideoTime']);
+ } else if (!empty($video['externalOptions'])) {
+ $json = _json_decode($video['externalOptions']);
+ if (!empty($json->videoStartSeconds)) {
+ $currentTime = intval(parseDurationToSeconds($json->videoStartSeconds));
+ } else {
+ $currentTime = 0;
+ }
+ }
+ $maxCurrentTime = parseDurationToSeconds($video['duration']);
+ if ($maxCurrentTime <= $currentTime + 5) {
$currentTime = 0;
}
}
- } else if (!empty($video['externalOptions']) && !empty($video['externalOptions']->videoStartSeconds)) {
- $currentTime = intval($video['externalOptions']->videoStartSeconds);
}
return $currentTime;
}
static function setIMAADTag($tag) {
global $IMAADTag;
$IMAADTag = $tag;
}
static function playerJSCodeOnLoad($videos_id, $nextURL = "") {
$js = "";
$videos_id = intval($videos_id);
if (empty($videos_id)) {
return false;
}
$video = new Video("", "", $videos_id);
if (!empty($video) && empty($nextURL)) {
if (!empty($video->getNext_videos_id())) {
$next_video = Video::getVideo($video->getNext_videos_id());
if (!empty($next_video['id'])) {
$nextURL = Video::getURLFriendly($next_video['id'], isEmbed());
}
} else {
$catName = @$_GET['catName'];
$cat = new Category($video->getCategories_id());
$_GET['catName'] = $cat->getClean_name();
$next_video = Video::getVideo('', 'viewable', false, true);
$_GET['catName'] = $catName;
if (!empty($next_video['id'])) {
$nextURL = Video::getURLFriendly($next_video['id'], isEmbed());
}
}
}
$url = Video::getURLFriendly($videos_id);
$js .= "
player.on('play', function () {
addView({$videos_id}, this.currentTime());
});
player.on('timeupdate', function () {
var time = Math.round(this.currentTime());
var url = '{$url}';
if (url.indexOf('?') > -1) {
url += '&t=' + time;
} else {
url += '?t=' + time;
}
$('#linkCurrentTime, .linkCurrentTime').val(url);
if (time >= 5 && time % 30 === 0) {
addView({$videos_id}, time);
}
});
player.on('ended', function () {
var time = Math.round(this.currentTime());
addView({$videos_id}, time);
});";
if (!empty($nextURL)) {
$js .= "playNextURL = '{$nextURL}';";
$js .= "player.on('ended', function () {setTimeout(function(){if(playNextURL){playNext(playNextURL);}},playerHasAds()?10000:500);});";
}
self::getStartPlayerJS($js);
return true;
}
static private function prepareStartPlayerJS($onPlayerReady = "", $getDataSetup = "") {
global $prepareStartPlayerJS_onPlayerReady, $prepareStartPlayerJS_getDataSetup;
if (empty($prepareStartPlayerJS_onPlayerReady)) {
$prepareStartPlayerJS_onPlayerReady = array();
}
if (empty($prepareStartPlayerJS_getDataSetup)) {
$prepareStartPlayerJS_getDataSetup = array();
}
if (!empty($onPlayerReady)) {
$prepareStartPlayerJS_onPlayerReady[] = $onPlayerReady;
}
if (!empty($getDataSetup)) {
$prepareStartPlayerJS_getDataSetup[] = $getDataSetup;
}
}
static function isAutoplayEnabled() {
global $config;
if (isLive()) {
return true;
}
if (!empty($_COOKIE['autoplay'])) {
if (strtolower($_COOKIE['autoplay']) === 'false') {
return false;
} else {
return true;
}
}
return $config->getAutoplay();
}
public static function getVideoTags($videos_id) {
if (empty($videos_id)) {
return array();
}
$name = "PlayeSkins_getVideoTags{$videos_id}";
$tags = ObjectYPT::getCache($name, 0);
if (empty($tags)) {
//_error_log("Cache not found $name");
$video = new Video("", "", $videos_id);
$fileName = $video->getFilename();
$resolution = Video::getHigestResolution($fileName);
$obj = new stdClass();
if (empty($resolution) || empty($resolution['resolution_text'])) {
$obj->label = '';
$obj->type = "";
$obj->text = "";
} else {
$obj->label = 'Plugin';
$obj->type = "danger";
$obj->text = $resolution['resolution_text'];
$obj->tooltip = $resolution['resolution'] . 'p';
}
$tags = $obj;
ObjectYPT::setCache($name, $tags);
}
return array($tags);
}
}
diff --git a/view/modeYoutube.php b/view/modeYoutube.php
index 430ec29e3..c96e0b329 100644
--- a/view/modeYoutube.php
+++ b/view/modeYoutube.php
@@ -1,416 +1,421 @@
thumbnails;
$poster = $evideo->thumbnails;
$imgw = 1280;
$imgh = 720;
$autoPlaySources = array();
$autoPlayURL = '';
$autoPlayPoster = '';
$autoPlayThumbsSprit = '';
} else {
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/category.php';
require_once $global['systemRootPath'] . 'objects/subscribe.php';
require_once $global['systemRootPath'] . 'objects/functions.php';
$img = "".getCDN()."view/img/notfound.jpg";
$poster = "".getCDN()."view/img/notfound.jpg";
$imgw = 1280;
$imgh = 720;
if (!empty($_GET['type'])) {
if ($_GET['type'] == 'audio') {
$_SESSION['type'] = 'audio';
} else
if ($_GET['type'] == 'video') {
$_SESSION['type'] = 'video';
} else
if ($_GET['type'] == 'pdf') {
$_SESSION['type'] = 'pdf';
} else {
$_SESSION['type'] = "";
unset($_SESSION['type']);
}
} else {
unset($_SESSION['type']);
}
session_write_close();
$modeYouTubeTimeLog['Code part 1'] = microtime(true) - $modeYouTubeTime;
$modeYouTubeTime = microtime(true);
if (!empty($_GET['playlist_id'])) {
$isSerie = 1;
if (preg_match("/^[0-9]+$/", $_GET['playlist_id'])) {
$playlist_id = $_GET['playlist_id'];
} else if (User::isLogged()) {
if ($_GET['playlist_id'] == "favorite") {
$playlist_id = PlayList::getFavoriteIdFromUser(User::getId());
} else {
$playlist_id = PlayList::getWatchLaterIdFromUser(User::getId());
}
}
if (!empty($_GET['playlist_index'])) {
$playlist_index = $_GET['playlist_index'];
}
$videosArrayId = PlayList::getVideosIdFromPlaylist($playlist_id);
if (empty($videosArrayId)) {
videoNotFound(__('Playlist is empty or does not exist'));
}
$videosPlayList = Video::getAllVideos("viewable", false, false, $videosArrayId, false, true);
$videosPlayList = PlayList::sortVideos($videosPlayList, $videosArrayId);
$videoSerie = Video::getVideoFromSeriePlayListsId($playlist_id);
unset($_GET['playlist_id']);
$isPlayListTrailer = false;
$playListObject = AVideoPlugin::getObjectData("PlayLists");
if (!empty($videoSerie)) {
$videoSerie = Video::getVideo($videoSerie["id"], "", true);
if (!empty($playListObject->showTrailerInThePlayList) && !empty($videoSerie["trailer1"]) && filter_var($videoSerie["trailer1"], FILTER_VALIDATE_URL) !== FALSE) {
$videoSerie["type"] = "embed";
$videoSerie["videoLink"] = $videoSerie["trailer1"];
array_unshift($videosPlayList, $videoSerie);
array_unshift($videosArrayId, $videoSerie['id']);
$isPlayListTrailer = true;
}
}
if (empty($playlist_index) && $isPlayListTrailer && !empty($videoSerie)) {
$video = $videoSerie;
} else {
$vid = new Video("", "", $videosPlayList[$playlist_index]['id']);
$_GET['videoName'] = $vid->getClean_title();
$video = Video::getVideo($videosPlayList[$playlist_index]['id'], "viewable", false, false, false, true);
}
if (!empty($videosPlayList[$playlist_index + 1])) {
$autoPlayVideo = Video::getVideo($videosPlayList[$playlist_index + 1]['id'], "viewableNotUnlisted", false, false, false, true);
$autoPlayVideo['url'] = $global['webSiteRootURL'] . "playlist/{$playlist_id}/" . ($playlist_index + 1);
} else if (!empty($videosPlayList[0])) {
$autoPlayVideo = Video::getVideo($videosPlayList[0]['id'], "viewableNotUnlisted", false, false, false, true);
$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 {
$catLink = "";
if (!empty($_GET['catName'])) {
$catLink = "cat/{$_GET['catName']}/";
}
// add this because if you change the video category the video was not loading anymore
$catName = @$_GET['catName'];
if (empty($_GET['clean_title']) && (isset($advancedCustom->forceCategory) && $advancedCustom->forceCategory === false)) {
$_GET['catName'] = "";
}
-
+
+ if (empty($video) && !empty($_REQUEST['v'])) {
+ $video = Video::getVideo($_REQUEST['v'], "viewable", false, false, false, true);
+ //var_dump('Line: '.__LINE__, $_REQUEST['v'], $video);exit;
+ }
+
if (empty($video)) {
$video = Video::getVideo("", "viewable", false, false, true, true);
}
if (empty($video)) {
$video = Video::getVideo("", "viewable", false, false, false, true);
}
if (empty($video)) {
$video = AVideoPlugin::getVideo();
}
if (!empty($_GET['v']) && (empty($video) || $video['id'] != $_GET['v'])) {
$video = false;
}
if (!empty($video['id'])) {
// allow users to count a view again in case it is refreshed
Video::unsetAddView($video['id']);
// add this because if you change the video category the video was not loading anymore
$_GET['catName'] = $catName;
$_GET['isMediaPlaySite'] = $video['id'];
$obj = new Video("", "", $video['id']);
}
/*
if (empty($_SESSION['type'])) {
$_SESSION['type'] = $video['type'];
}
*
*/
// $resp = $obj->addView();
$get = array('channelName' => @$_GET['channelName'], 'catName' => @$_GET['catName']);
$modeYouTubeTimeLog['Code part 1.1'] = microtime(true) - $modeYouTubeTime;
$modeYouTubeTime = microtime(true);
if (!empty($video['next_videos_id'])) {
$modeYouTubeTimeLog['Code part 1.2'] = microtime(true) - $modeYouTubeTime;
$modeYouTubeTime = microtime(true);
$autoPlayVideo = Video::getVideo($video['next_videos_id']);
} else {
$modeYouTubeTimeLog['Code part 1.3'] = microtime(true) - $modeYouTubeTime;
$modeYouTubeTime = microtime(true);
$modeYouTubeTimeLog['Code part 1.5'] = microtime(true) - $modeYouTubeTime;
$modeYouTubeTime = microtime(true);
if (!empty($video['id'])) {
$autoPlayVideo = Video::getRandom($video['id']);
}
//}
}
$modeYouTubeTimeLog['Code part 1.6'] = microtime(true) - $modeYouTubeTime;
$modeYouTubeTime = microtime(true);
if (!empty($autoPlayVideo)) {
$autoPlayVideo['creator'] = Video::getCreatorHTML($autoPlayVideo['users_id']);
$autoPlayVideo['tags'] = Video::getTags($autoPlayVideo['id'], '
' . humanTiming(strtotime($autoPlayVideo['videoCreation'])) . '');
$autoPlayVideo['url'] = Video::getLink($autoPlayVideo['id'], $autoPlayVideo['clean_title'], false, $get);
}
}
$modeYouTubeTimeLog['Code part 2'] = microtime(true) - $modeYouTubeTime;
$modeYouTubeTime = microtime(true);
if (!empty($video)) {
$name = User::getNameIdentificationById($video['users_id']);
$name = "{$name} " . User::getEmailVerifiedIcon($video['users_id']) . "";
$subscribe = Subscribe::getButton($video['users_id']);
$video['creator'] = Video::getCreatorHTML($video['users_id'], '' . humanTiming(strtotime($video['videoCreation'])) . '');
$obj = new Video("", "", $video['id']);
// Don't need because have an embedded video on this page
// $resp = $obj->addView();
}
if (!empty($video) && $video['type'] == "video") {
$poster = "{$global['webSiteRootURL']}videos/{$video['filename']}.jpg";
} else {
$poster = "".getCDN()."view/img/audio_wave.jpg";
}
if (!empty($video)) {
$source = Video::getSourceFile($video['filename']);
if (($video['type'] !== "audio") && ($video['type'] !== "linkAudio") && !empty($source['url'])) {
$img = $source['url'];
$data = getimgsize($source['path']);
$imgw = $data[0];
$imgh = $data[1];
} else if ($video['type'] == "audio") {
$img = "".getCDN()."view/img/audio_wave.jpg";
}
$type = 'video';
if ($video['type'] === 'pdf') {
$type = 'pdf';
} else if ($video['type'] === 'zip') {
$type = 'zip';
} else if ($video['type'] === 'article') {
$type = 'article';
}
$images = Video::getImageFromFilename($video['filename'], $type);
$poster = isMobile() ? $images->thumbsJpg : $images->poster;
if (!empty($images->posterPortrait) && basename($images->posterPortrait) !== 'notfound_portrait.jpg' && basename($images->posterPortrait) !== 'pdf_portrait.png' && basename($images->posterPortrait) !== 'article_portrait.png') {
$img = $images->posterPortrait;
$data = getimgsize($source['path']);
$imgw = $data[0];
$imgh = $data[1];
} else {
$img = isMobile() ? $images->thumbsJpg : $images->poster;
}
} else {
$poster = "".getCDN()."view/img/notfound.jpg";
}
$objSecure = AVideoPlugin::getObjectDataIfEnabled('SecureVideosDirectory');
$modeYouTubeTimeLog['Code part 3'] = microtime(true) - $modeYouTubeTime;
$modeYouTubeTime = microtime(true);
if (!empty($autoPlayVideo) && !empty($autoPlayVideo['filename'])) {
$autoPlaySources = getSources($autoPlayVideo['filename'], true);
$autoPlayURL = $autoPlayVideo['url'];
$autoPlayPoster = "{$global['webSiteRootURL']}videos/{$autoPlayVideo['filename']}.jpg";
$autoPlayThumbsSprit = "{$global['webSiteRootURL']}videos/{$autoPlayVideo['filename']}_thumbsSprit.jpg";
} else {
$autoPlaySources = array();
$autoPlayURL = '';
$autoPlayPoster = '';
$autoPlayThumbsSprit = "";
}
if (empty($_GET['videoName']) && !empty($video)) {
$_GET['videoName'] = $video['clean_title'];
}
if(!empty($_GET['videoName'])){
$v = Video::getVideoFromCleanTitle($_GET['videoName']);
}
if (empty($v) && empty($videosPlayList[$playlist_index]['id'])) {
videoNotFound("");
} else {
$modeYouTubeTimeLog['Code part 4'] = microtime(true) - $modeYouTubeTime;
$modeYouTubeTime = microtime(true);
AVideoPlugin::getModeYouTube($v['id']);
$modeYouTubeTimeLog['Code part 5'] = microtime(true) - $modeYouTubeTime;
$modeYouTubeTime = microtime(true);
}
}
// video not found
if (empty($video)) {
/*
$img = "".getCDN()."view/img/this-video-is-not-available.jpg";
$poster = "".getCDN()."view/img/this-video-is-not-available.jpg";
$imgw = 1280;
$imgh = 720;
unset($_SESSION['type']);
session_write_close();
$video = array();
$video['id'] = 0;
$video['type'] = 'notfound';
$video['rotation'] = 0;
$video['videoLink'] = "";
$video['title'] = __("Video Not Available");
$video['clean_title'] = "video-not-available";
$video['description'] = "";
$video['duration'] = "";
$video['creator'] = "";
$video['likes'] = "";
$video['dislikes'] = "";
$video['category'] = "embed";
$video['views_count'] = 0;
$video['filename'] = "";
header('HTTP/1.0 404 Not Found', true, 404);
*
*/
videoNotFound('The video is not available');
}
$metaDescription = " {$video['id']}";
// make sure the title tag does not have more then 70 chars
$titleTag = $video['title'];
$titleTag = (strlen($titleTag) > 50) ? (substr($titleTag, 0, 48) . " …") : $titleTag;
$titleTag .= getSEOComplement(array("allowedTypes" => array("audio", "video", "pdf"))) . $config->getPageTitleSeparator() . $config->getWebSiteTitle();
$titleTag = (strlen($titleTag) > 70) ? (substr($titleTag, 0, 68) . " …") : $titleTag;
if (!empty($video['users_id']) && User::hasBlockedUser($video['users_id'])) {
$video['type'] = "blockedUser";
}
?>
showChannelBannerOnModeYoutube)) {
?>
! videoNotFoundText->value) ? __("We have not found any videos or audios to show") : $advancedCustom->videoNotFoundText->value; ?>.
disableYoutubePlayerIntegration || isMobile();
if ((isset($_GET['isEmbedded'])) && ($disableYoutubeIntegration == false)) {
if ($_GET['isEmbedded'] == "y") {
?>
$value) {
if ($value > 0.5) {
echo "*** ";
}
echo "{$key} = {$value} seconds \n";
}
echo "\n -->";
?>