mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 19:42:38 +02:00
This commit is contained in:
parent
e5c7d47d69
commit
e6123f49ba
14 changed files with 425 additions and 341 deletions
|
@ -20,6 +20,10 @@ if(!empty($_REQUEST['showAll'])){
|
|||
}
|
||||
}
|
||||
|
||||
if(empty($_REQUEST['current'])){
|
||||
$_REQUEST['current'] = getCurrentPage();
|
||||
}
|
||||
|
||||
$videos = Video::getAllVideos('', $showOnlyLoggedUserVideos, true, array(), false, $showUnlisted, $activeUsersOnly);
|
||||
$total = Video::getTotalVideos('', $showOnlyLoggedUserVideos, true, $showUnlisted, $activeUsersOnly);
|
||||
foreach ($videos as $key => $value) {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* https://support.google.com/adsense/answer/4455881
|
||||
* https://support.google.com/adsense/answer/1705822
|
||||
|
@ -11,6 +10,7 @@ require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
|
|||
require_once $global['systemRootPath'] . 'plugin/AD_Server/Objects/VastCampaigns.php';
|
||||
|
||||
class AD_Server extends PluginAbstract {
|
||||
|
||||
public function getTags() {
|
||||
return array(
|
||||
PluginTags::$MONETIZATION,
|
||||
|
@ -59,7 +59,7 @@ class AD_Server extends PluginAbstract {
|
|||
$vc = new VastCampaigns($obj->autoAddNewVideosInCampaignId);
|
||||
if (!empty($vc->getName())) {
|
||||
$video = new Video("", "", $videos_id);
|
||||
if(!empty($video->getTitle())){
|
||||
if (!empty($video->getTitle())) {
|
||||
_error_log("AD_Server:afterNewVideo saving");
|
||||
$o = new VastCampaignsVideos(0);
|
||||
$o->setVast_campaigns_id($obj->autoAddNewVideosInCampaignId);
|
||||
|
@ -69,13 +69,13 @@ class AD_Server extends PluginAbstract {
|
|||
$o->setStatus('a');
|
||||
$id = $o->save();
|
||||
_error_log("AD_Server:afterNewVideo saved {$id}");
|
||||
}else{
|
||||
} else {
|
||||
_error_log("AD_Server:afterNewVideo videos_id NOT found {$videos_id}");
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
_error_log("AD_Server:afterNewVideo autoAddNewVideosInCampaignId NOT found {$obj->autoAddNewVideosInCampaignId}");
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
_error_log("AD_Server:afterNewVideo is disabled");
|
||||
}
|
||||
return true;
|
||||
|
@ -95,7 +95,7 @@ class AD_Server extends PluginAbstract {
|
|||
//_error_log("Show Ads Count started");
|
||||
$_SESSION['showAdsCount'] = 1;
|
||||
} else {
|
||||
$_SESSION['showAdsCount'] ++;
|
||||
$_SESSION['showAdsCount']++;
|
||||
}
|
||||
}
|
||||
//_error_log("Show Ads Count {$_SESSION['showAdsCount']}");
|
||||
|
@ -120,18 +120,19 @@ class AD_Server extends PluginAbstract {
|
|||
|
||||
if (!empty($obj->showMarkers)) {
|
||||
$css .= '<link href="' . $global['webSiteRootURL'] . 'plugin/AD_Server/videojs-markers/videojs.markers.css" rel="stylesheet" type="text/css"/>';
|
||||
|
||||
}
|
||||
$css .= '<style>.ima-ad-container{z-index:1000 !important;}</style>';
|
||||
return $js . $css;
|
||||
}
|
||||
|
||||
public function afterVideoJS() {
|
||||
|
||||
$obj = $this->getDataObject();
|
||||
if (!$this->canLoadAds() || empty($_GET['vmap_id'])) {
|
||||
return "";
|
||||
}
|
||||
global $global;
|
||||
|
||||
if (empty($_GET['u'])) {
|
||||
$video = Video::getVideoFromCleanTitle($_GET['videoName']);
|
||||
} else {
|
||||
|
@ -140,18 +141,45 @@ class AD_Server extends PluginAbstract {
|
|||
$video_length = parseDurationToSeconds($video['duration']);
|
||||
$vmap_id = @$_GET['vmap_id'];
|
||||
|
||||
if (!empty($_GET['vmap_id']) && !empty($_SESSION['vmap'][$_GET['vmap_id']])) {
|
||||
$vmaps = unserialize($_SESSION['vmap'][$_GET['vmap_id']]);
|
||||
_session_start();
|
||||
if (!empty($_GET['vmap_id']) && !empty($_SESSION['user']['vmap'][$_GET['vmap_id']])) {
|
||||
$vmaps = unserialize($_SESSION['user']['vmap'][$_GET['vmap_id']]);
|
||||
} else {
|
||||
$vmaps = $this->getVMAPs($video_length);
|
||||
$_SESSION['vmap'][$_GET['vmap_id']] = serialize($vmaps);
|
||||
$_SESSION['user']['vmap'][$_GET['vmap_id']] = serialize($vmaps);
|
||||
}
|
||||
PlayerSkins::setIMAADTag("{$global['webSiteRootURL']}plugin/AD_Server/VMAP.php?video_length={$video_length}&vmap_id={$vmap_id}&random=" . uniqid());
|
||||
$onPlayerReady = "";
|
||||
|
||||
if (!empty($obj->showMarkers)) {
|
||||
$onPlayerReady .= "
|
||||
player.markers({
|
||||
markerStyle: {
|
||||
'width': '5px',
|
||||
'background-color': 'yellow'
|
||||
},
|
||||
markerTip: {
|
||||
display: true,
|
||||
text: function (marker) {
|
||||
return marker.text;
|
||||
}
|
||||
},
|
||||
markers: [";
|
||||
foreach ($vmaps as $value) {
|
||||
$vastCampaingVideos = new VastCampaignsVideos($value->VAST->campaing);
|
||||
$video = new Video("", "", $vastCampaingVideos->getVideos_id());
|
||||
$onPlayerReady .= "{time: {$value->timeOffsetSeconds}, text: \"".addcslashes($video->getTitle(), '"')."\"},";
|
||||
}
|
||||
$onPlayerReady .= "]});";
|
||||
}
|
||||
|
||||
if ($this->VMAPsHasVideos()) {
|
||||
include $global['systemRootPath'] . 'plugin/AD_Server/footer.php';
|
||||
} else {
|
||||
echo "<!-- NO Videos found for VAST ads -->";
|
||||
}
|
||||
|
||||
PlayerSkins::getStartPlayerJS($onPlayerReady);
|
||||
$js = '';
|
||||
$js .= '<script src="' . $global['webSiteRootURL'] . 'js/videojs-contrib-ads/videojs.ads.js"></script>';
|
||||
$js .= '<script src="' . $global['webSiteRootURL'] . 'plugin/AD_Server/videojs-ima/videojs.ima.js"></script>';
|
||||
$js .= '<script src="' . $global['webSiteRootURL'] . 'plugin/AD_Server/videojs-markers/videojs-markers.js"></script>';
|
||||
return $js;
|
||||
}
|
||||
|
||||
private function getRandomPositions() {
|
||||
|
@ -350,9 +378,9 @@ class VAST {
|
|||
function __construct($id) {
|
||||
$this->id = $id;
|
||||
$row = AD_Server::getRandomVideo();
|
||||
if(!empty($row)){
|
||||
if (!empty($row)) {
|
||||
$this->campaing = $row['id'];
|
||||
}else{
|
||||
} else {
|
||||
$this->campaing = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,13 +15,13 @@ if(empty($_GET['vmap_id'])){
|
|||
$_GET['vmap_id'] = uniqid();
|
||||
}
|
||||
|
||||
if(!empty($_GET['vmap_id']) && !empty($_SESSION['vmap'][$_GET['vmap_id']])){
|
||||
$vmaps = unserialize($_SESSION['vmap'][$_GET['vmap_id']]);
|
||||
if(!empty($_GET['vmap_id']) && !empty($_SESSION['user']['vmap'][$_GET['vmap_id']])){
|
||||
$vmaps = unserialize($_SESSION['user']['vmap'][$_GET['vmap_id']]);
|
||||
}else{
|
||||
$vmaps = $ad_server->getVMAPs($_GET['video_length']);
|
||||
$_SESSION['vmap'][$_GET['vmap_id']] = serialize($vmaps);
|
||||
$_SESSION['user']['vmap'][$_GET['vmap_id']] = serialize($vmaps);
|
||||
}
|
||||
unset($_SESSION['vmap'][$_GET['vmap_id']]);
|
||||
unset($_SESSION['user']['vmap'][$_GET['vmap_id']]);
|
||||
//var_dump($vmaps);exit;
|
||||
?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<?php
|
||||
|
||||
global $global;
|
||||
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
|
||||
|
||||
class AdsForJesus extends PluginAbstract {
|
||||
|
||||
public function getTags() {
|
||||
return array(
|
||||
PluginTags::$ADS,
|
||||
|
@ -15,7 +17,7 @@ class AdsForJesus extends PluginAbstract {
|
|||
$txt = " We will provide a simple VMAP Ad link for free, these ads will be placed in your videos.<br>"
|
||||
. "This will give your users the greatest wisdom of all, as well as invaluable value. <i class=\"fas fa-pray\"> </i> <i class=\"fas fa-cross fa-2x \"></i>";
|
||||
|
||||
return $txt ;
|
||||
return $txt;
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
|
@ -47,7 +49,7 @@ class AdsForJesus extends PluginAbstract {
|
|||
public function getHTMLMenuRight() {
|
||||
global $global;
|
||||
$obj = $this->getDataObject();
|
||||
if(empty($obj->topMenuLink)){
|
||||
if (empty($obj->topMenuLink)) {
|
||||
return '';
|
||||
}
|
||||
return '<li>
|
||||
|
@ -98,63 +100,13 @@ class AdsForJesus extends PluginAbstract {
|
|||
$js .= '<script src="//imasdk.googleapis.com/js/sdkloader/ima3.js"></script>';
|
||||
$js .= '<script src="' . $global['webSiteRootURL'] . 'js/videojs-contrib-ads/videojs.ads.js" type="text/javascript"></script>
|
||||
<script src="' . $global['webSiteRootURL'] . 'plugin/AD_Server/videojs-ima/videojs.ima.js" type="text/javascript"></script>';
|
||||
}
|
||||
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}");
|
||||
$onPlayerReady = "
|
||||
";
|
||||
PlayerSkins::getStartPlayerJS($onPlayerReady);
|
||||
|
||||
$js .= "<script>
|
||||
var player = videojs('mainVideo'".PlayerSkins::getDataSetup().");
|
||||
var options = {
|
||||
id: 'mainVideo',
|
||||
adTagUrl: 'https://forjesus.tv/vmap.xml?video_durarion={$video_length}&start={$obj->start}&mid25Percent={$obj->mid25Percent}&mid50Percent={$obj->mid50Percent}&mid75Percent={$obj->mid75Percent}&end={$obj->end}'
|
||||
};
|
||||
try{
|
||||
player.ima(options);
|
||||
}catch(e){}
|
||||
</script>";
|
||||
$js .= "
|
||||
<script>
|
||||
function fixAdSize(){
|
||||
ad_container = $('#mainVideo_ima-ad-container');
|
||||
if(ad_container.length){
|
||||
height = ad_container.css('height');
|
||||
width = ad_container.css('width');
|
||||
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({'height': height});
|
||||
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({'width': width});
|
||||
}
|
||||
}
|
||||
$(function () {
|
||||
// Remove controls from the player on iPad to stop native controls from stealing
|
||||
// our click
|
||||
var contentPlayer = document.getElementById('content_video_html5_api');
|
||||
if ((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
|
||||
// first time it's clicked.
|
||||
var startEvent = 'click';
|
||||
if (navigator.userAgent.match(/iPhone/i) ||
|
||||
navigator.userAgent.match(/iPad/i) ||
|
||||
navigator.userAgent.match(/Android/i)) {
|
||||
startEvent = 'touchend';
|
||||
}
|
||||
if (typeof player !== 'undefined') {
|
||||
player.one(startEvent, function () {
|
||||
player.ima.initializeAdDisplayContainer();
|
||||
});
|
||||
}else{
|
||||
setTimeout(function(){
|
||||
if (typeof player !== 'undefined') {
|
||||
player.one(startEvent, function () {
|
||||
player.ima.initializeAdDisplayContainer();
|
||||
});
|
||||
}
|
||||
},2000);
|
||||
}
|
||||
setInterval(function(){ fixAdSize(); }, 300);
|
||||
});
|
||||
</script>";
|
||||
}
|
||||
return $js;
|
||||
}
|
||||
|
||||
|
|
|
@ -270,8 +270,14 @@ class CustomizeAdvanced extends PluginAbstract {
|
|||
|
||||
public function getHeadCode() {
|
||||
global $global;
|
||||
$obj = $this->getDataObject();
|
||||
$baseName = basename($_SERVER['REQUEST_URI']);
|
||||
$js = "";
|
||||
if(empty($obj->autoPlayAjax)){
|
||||
$js .= "<script>var autoPlayAjax=false;</script>";
|
||||
}else{
|
||||
$js .= "<script>var autoPlayAjax=true;</script>";
|
||||
}
|
||||
if ($baseName === 'mvideos') {
|
||||
$js .= "<script>function updateDiskUsage(videos_id){
|
||||
modal.showPleaseWait();
|
||||
|
|
|
@ -71,6 +71,7 @@ class PlayerSkins extends PluginAbstract {
|
|||
} else {
|
||||
$js .= "<script>var autoplay = false;</script>";
|
||||
}
|
||||
$js .= "<script>var playNextURL = '';</script>";
|
||||
$css .= "<link href=\"{$global['webSiteRootURL']}plugin/PlayerSkins/skins/{$obj->skin}.css\" rel=\"stylesheet\" type=\"text/css\"/>";
|
||||
if ($obj->showLoopButton && !isLive()) {
|
||||
$css .= "<link href=\"{$global['webSiteRootURL']}plugin/PlayerSkins/loopbutton.css\" rel=\"stylesheet\" type=\"text/css\"/>";
|
||||
|
@ -109,9 +110,7 @@ class PlayerSkins extends PluginAbstract {
|
|||
$js = "<!-- playerSkin -->";
|
||||
$obj = $this->getDataObject();
|
||||
if (!empty($_GET['videoName']) || !empty($_GET['u']) || !empty($_GET['evideo']) || !empty($_GET['playlists_id'])) {
|
||||
if ($obj->showLoopButton && !isLive()) {
|
||||
$js .= "<script src=\"{$global['webSiteRootURL']}plugin/PlayerSkins/loopbutton.js\"></script>";
|
||||
} else if (empty($obj->showLoopButton) && empty($playerSkinsObj->contextMenuLoop)) {
|
||||
if (empty($obj->showLoopButton) && empty($playerSkinsObj->contextMenuLoop)) {
|
||||
$js .= "<script>setPlayerLoop(false);</script>";
|
||||
}
|
||||
if ($obj->showLogoOnEmbed && isEmbed() || $obj->showLogo) {
|
||||
|
@ -123,7 +122,7 @@ class PlayerSkins extends PluginAbstract {
|
|||
}
|
||||
if (!empty($getStartPlayerJSWasRequested) || isVideo()) {
|
||||
$js .= "<script src=\"{$global['webSiteRootURL']}view/js/videojs-persistvolume/videojs.persistvolume.js\"></script>";
|
||||
$js .= "<script>".self::getStartPlayerJSCode(true)."</script>";
|
||||
$js .= "<script>" . self::getStartPlayerJSCode() . "</script>";
|
||||
}
|
||||
return $js;
|
||||
}
|
||||
|
@ -167,20 +166,61 @@ class PlayerSkins extends PluginAbstract {
|
|||
global $getStartPlayerJSWasRequested;
|
||||
self::prepareStartPlayerJS($onPlayerReady, $getDataSetup);
|
||||
$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) . '", $onPlayerReady = "' . $onPlayerReady . '", $getDataSetup = "' . $getDataSetup . '" */';
|
||||
return '/* getStartPlayerJS $prepareStartPlayerJS_onPlayerReady = "' . count($prepareStartPlayerJS_onPlayerReady) . '", $prepareStartPlayerJS_getDataSetup = "' . count($prepareStartPlayerJS_getDataSetup) . '" */';
|
||||
}
|
||||
|
||||
static function getStartPlayerJSCode($noReadyFunction = false) {
|
||||
global $config, $global, $prepareStartPlayerJS_onPlayerReady, $prepareStartPlayerJS_getDataSetup;
|
||||
static function getStartPlayerJSCode($noReadyFunction = false, $currentTime = 0) {
|
||||
global $config, $global, $prepareStartPlayerJS_onPlayerReady, $prepareStartPlayerJS_getDataSetup, $IMAADTag;
|
||||
$obj = AVideoPlugin::getObjectData('PlayerSkins');
|
||||
$js = "";
|
||||
if (empty($noReadyFunction)) {
|
||||
$js .= "$(document).ready(function () {";
|
||||
$js .= "var originalVideo; "
|
||||
. "$(document).ready(function () {";
|
||||
}
|
||||
$js .= "
|
||||
/* prepareStartPlayerJS_onPlayerReady = ".count($prepareStartPlayerJS_onPlayerReady).", prepareStartPlayerJS_getDataSetup = ".count($prepareStartPlayerJS_getDataSetup)." */
|
||||
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)){
|
||||
$js .= "var options = {id: 'mainVideo', adTagUrl: '{$IMAADTag}'}; player.ima(options);";
|
||||
$js .= "setInterval(function(){ fixAdSize(); }, 300);"
|
||||
. "// Remove controls from the player on iPad to stop native controls from stealing
|
||||
// our click
|
||||
var contentPlayer = document.getElementById('content_video_html5_api');
|
||||
if ((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
|
||||
// first time it's clicked.
|
||||
var startEvent = 'click';
|
||||
if (navigator.userAgent.match(/iPhone/i) ||
|
||||
navigator.userAgent.match(/iPad/i) ||
|
||||
navigator.userAgent.match(/Android/i)) {
|
||||
startEvent = 'touchend';
|
||||
}
|
||||
if (typeof player !== 'undefined') {
|
||||
player.one(startEvent, function () {
|
||||
player.ima.initializeAdDisplayContainer();
|
||||
});
|
||||
}else{
|
||||
setTimeout(function(){
|
||||
if (typeof player !== 'undefined') {
|
||||
player.one(startEvent, function () {
|
||||
player.ima.initializeAdDisplayContainer();
|
||||
});
|
||||
}
|
||||
},2000);
|
||||
} ";
|
||||
}
|
||||
|
||||
$js .= "}
|
||||
player.ready(function () {
|
||||
var err = this.error();
|
||||
if (err && err.code) {
|
||||
|
@ -188,12 +228,14 @@ class PlayerSkins extends PluginAbstract {
|
|||
$('#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 ($config->getAutoplay()) {
|
||||
$js .= "setTimeout(function(){playerPlay(0);},500);";
|
||||
|
||||
if ($obj->showLoopButton && !isLive()) {
|
||||
$js .= file_get_contents($global['systemRootPath'].'plugin/PlayerSkins/loopbutton.js');
|
||||
}
|
||||
|
||||
if (empty($noReadyFunction)) {
|
||||
|
@ -203,6 +245,55 @@ class PlayerSkins extends PluginAbstract {
|
|||
return $js;
|
||||
}
|
||||
|
||||
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($nextURL)) {
|
||||
$next_video = Video::getVideo($video->getNext_videos_id());
|
||||
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 % 5 === 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(){playNext(playNextURL);},playerHasAds()?2000:500);});";
|
||||
}
|
||||
self::getStartPlayerJS($js);
|
||||
return true;
|
||||
}
|
||||
|
||||
static private function prepareStartPlayerJS($onPlayerReady = "", $getDataSetup = "") {
|
||||
global $prepareStartPlayerJS_onPlayerReady, $prepareStartPlayerJS_getDataSetup;
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
$(document).ready(function () {
|
||||
var Button = videojs.getComponent('Button');
|
||||
|
||||
var Button = videojs.getComponent('Button');
|
||||
|
||||
var LoopButton = videojs.extend(Button, {
|
||||
var LoopButton = videojs.extend(Button, {
|
||||
//constructor: function(player, options) {
|
||||
constructor: function () {
|
||||
Button.apply(this, arguments);
|
||||
|
@ -17,8 +15,7 @@ $(document).ready(function () {
|
|||
handleClick: function () {
|
||||
tooglePlayerLoop();
|
||||
}
|
||||
});
|
||||
|
||||
videojs.registerComponent('LoopButton', LoopButton);
|
||||
player.getChild('controlBar').addChild('LoopButton', {}, 0);
|
||||
});
|
||||
|
||||
videojs.registerComponent('LoopButton', LoopButton);
|
||||
player.getChild('controlBar').addChild('LoopButton', {}, 0);
|
|
@ -66,6 +66,7 @@
|
|||
$_GET['isEmbedded'] = "v";
|
||||
}
|
||||
$_GET['isMediaPlaySite'] = $video['id'];
|
||||
PlayerSkins::playerJSCodeOnLoad($video['id'], @$autoPlayVideo['url']);
|
||||
?>
|
||||
<div id="main-video" class="embed-responsive embed-responsive-16by9">
|
||||
<video playsinline webkit-playsinline="webkit-playsinline" id="mainVideo" class="embed-responsive-item video-js vjs-default-skin <?php echo $vjsClass; ?> vjs-big-play-centered" controls <?php
|
||||
|
@ -87,44 +88,8 @@
|
|||
|
||||
//$(".vjs-big-play-button").hide();
|
||||
$(".vjs-control-bar").css("opacity: 1; visibility: visible;");
|
||||
if (typeof player === 'undefined') {
|
||||
player = videojs('mainVideo'<?php echo PlayerSkins::getDataSetup(); ?>);
|
||||
}
|
||||
player.ready(function () {
|
||||
<?php
|
||||
if ($config->getAutoplay()) {
|
||||
echo "setTimeout(function () { if(typeof player === 'undefined'){ player = videojs('mainVideo'" . PlayerSkins::getDataSetup() . ");} playerPlay(0);}, 150);";
|
||||
} else {
|
||||
?>
|
||||
playerPlayIfAutoPlay(0);
|
||||
<?php } ?>
|
||||
num = $('#videosList').find('.pagination').find('li.active').attr('data-lp');
|
||||
loadPage(num);
|
||||
});
|
||||
player.persistvolume({
|
||||
namespace: "AVideo"
|
||||
});
|
||||
player.on('play', function () {
|
||||
addView(<?php echo $video['id']; ?>, this.currentTime());
|
||||
});
|
||||
player.on('ended', function () {
|
||||
console.log("Finish Video");
|
||||
<?php if (!empty($autoPlayVideo)) { ?>
|
||||
playNext('<?php echo $autoPlayVideo['url']; ?>');
|
||||
<?php } ?>
|
||||
|
||||
});
|
||||
player.on('timeupdate', function () {
|
||||
var time = Math.round(this.currentTime());
|
||||
if (time >= 5 && time % 5 === 0) {
|
||||
addView(<?php echo $video['id']; ?>, time);
|
||||
}
|
||||
});
|
||||
player.on('ended', function () {
|
||||
var time = Math.round(this.currentTime());
|
||||
addView(<?php echo $video['id']; ?>, time);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -85,7 +85,7 @@ $playerSkinsObj = AVideoPlugin::getObjectData("PlayerSkins");
|
|||
<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 } ?>
|
||||
|
||||
<a href="<?php echo $global["HTTP_REFERER"]; ?>" class="btn btn-outline btn-xs" style="position: absolute; top: 5px; right: 5px; display: none;" id="youtubeModeOnFullscreenCloseButton">
|
||||
<i class="fas fa-times"></i>
|
||||
|
@ -100,51 +100,7 @@ $playerSkinsObj = AVideoPlugin::getObjectData("PlayerSkins");
|
|||
var player;
|
||||
|
||||
<?php
|
||||
$onPlayerReady = "player.on('play', function () {addView({$playNowVideo['id']}, this.currentTime());});";
|
||||
|
||||
if ($config->getAutoplay()) {
|
||||
$onPlayerReady .= "playerPlay({$currentTime});";
|
||||
} else {
|
||||
$onPlayerReady .= "setCurrentTime({$currentTime});";
|
||||
}
|
||||
$onPlayerReady .= "player.on('ended', function () {console.log(\"Finish Video\");
|
||||
var time = Math.round(this.currentTime());
|
||||
addView({$video['id']}, time);";
|
||||
if (!empty($autoPlayVideo)) {
|
||||
$onPlayerReady .= "if (isAutoplayEnabled()) {";
|
||||
if ($autoPlayVideo['type'] !== 'video' || empty($advancedCustom->autoPlayAjax)) {
|
||||
$onPlayerReady .= "playNext(autoPlayURL);";
|
||||
} else {
|
||||
$onPlayerReady .= "$('video, #mainVideo').attr('poster', autoPlayPoster);
|
||||
changeVideoSrc(player, autoPlaySources);
|
||||
history.pushState(null, null, autoPlayURL);
|
||||
$('.vjs-thumbnail-holder, .vjs-thumbnail-holder img').attr('src', autoPlayThumbsSprit);
|
||||
$.ajax({
|
||||
url: autoPlayURL,
|
||||
success: function (response) {
|
||||
modeYoutubeBottom = $(response).find('#modeYoutubeBottom').html();
|
||||
$('#modeYoutubeBottom').html(modeYoutubeBottom);
|
||||
}
|
||||
});";
|
||||
}
|
||||
$onPlayerReady .= "}";
|
||||
}
|
||||
$onPlayerReady .= "});";
|
||||
$onPlayerReady .= "player.on('timeupdate', function () {
|
||||
var time = Math.round(this.currentTime());
|
||||
var url = '" . Video::getURLFriendly($video['id']) . "';
|
||||
if (url.indexOf('?') > -1) {
|
||||
url += '&t=' + time;
|
||||
} else {
|
||||
url += '?t=' + time;
|
||||
}
|
||||
$('#linkCurrentTime').val(url);
|
||||
if (time >= 5 && time % 5 === 0) {
|
||||
addView({$video['id']}, time);
|
||||
}
|
||||
});";
|
||||
|
||||
echo PlayerSkins::getStartPlayerJS($onPlayerReady);
|
||||
PlayerSkins::playerJSCodeOnLoad($playNowVideo['id'], @$autoPlayURL);
|
||||
?>
|
||||
|
||||
$(document).ready(function () {
|
||||
|
|
70
view/infoFromURL.php
Normal file
70
view/infoFromURL.php
Normal file
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
if (!isset($global['systemRootPath'])) {
|
||||
require_once '../videos/configuration.php';
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$obj = new stdClass();
|
||||
$obj->videos_id = "";
|
||||
$obj->poster = "";
|
||||
$obj->sources = "";
|
||||
$obj->url = "";
|
||||
$obj->friendly = "";
|
||||
$obj->embed = "";
|
||||
$obj->sprits = "";
|
||||
$obj->nextURL = "";
|
||||
$obj->nextURLEmbed = "";
|
||||
$obj->error = true;
|
||||
$obj->msg = "";
|
||||
if (empty($_GET['url'])) {
|
||||
$obj->msg = "empty URL";
|
||||
die(json_encode($obj));
|
||||
}
|
||||
$obj->url = $_GET['url'];
|
||||
$obj->vtt = array();
|
||||
|
||||
$patternURL = addcslashes($global['webSiteRootURL'], "/");
|
||||
|
||||
if (preg_match("/{$patternURL}v(ideo(Embed)?)?\/([0-9]+)/", $obj->url, $matches)) {
|
||||
if (empty($matches[3])) {
|
||||
$obj->msg = "videos_id NOT found";
|
||||
die(json_encode($obj));
|
||||
}
|
||||
} else {
|
||||
$obj->msg = "it is not a valid URL";
|
||||
die(json_encode($obj));
|
||||
}
|
||||
|
||||
$obj->videos_id = intval($matches[3]);
|
||||
|
||||
$video = Video::getVideo($obj->videos_id);
|
||||
|
||||
if (empty($video['filename'])) {
|
||||
$obj->msg = "Video Not found";
|
||||
die(json_encode($obj));
|
||||
}
|
||||
if ($video['type'] !== 'video') {
|
||||
$obj->msg = "Must be a video";
|
||||
die(json_encode($obj));
|
||||
}
|
||||
|
||||
$obj->error = false;
|
||||
|
||||
$obj->friendly = Video::getURLFriendly($obj->videos_id);
|
||||
$obj->embed = Video::getURLFriendly($obj->videos_id, true);
|
||||
$obj->sources = getSources($video['filename'], true);
|
||||
$obj->poster = "{$global['webSiteRootURL']}videos/{$video['filename']}.jpg";
|
||||
$obj->sprits = "{$global['webSiteRootURL']}videos/{$video['filename']}_thumbsSprit.jpg";
|
||||
|
||||
if (!empty($video['next_videos_id'])) {
|
||||
$obj->nextURL = Video::getURLFriendly($video['next_videos_id']);
|
||||
$obj->nextURLEmbed = Video::getURLFriendly($video['next_videos_id'], true);
|
||||
}
|
||||
|
||||
if (function_exists('getVTTTracks')) {
|
||||
$obj->vtt = getVTTTracks($video['filename'], true);
|
||||
}
|
||||
|
||||
die(json_encode($obj));
|
|
@ -272,12 +272,14 @@ function setPlayerListners() {
|
|||
if (typeof player !== 'undefined') {
|
||||
player.on('pause', function () {
|
||||
clearTimeout(promisePlayTimeout);
|
||||
userIsControling = true;
|
||||
console.log("setPlayerListners: pause");
|
||||
//userIsControling = true;
|
||||
});
|
||||
|
||||
player.on('play', function () {
|
||||
clearTimeout(promisePlayTimeout);
|
||||
userIsControling = true;
|
||||
console.log("setPlayerListners: play");
|
||||
//userIsControling = true;
|
||||
});
|
||||
} else {
|
||||
setTimeout(function () {
|
||||
|
@ -299,6 +301,11 @@ function changeVideoSrc(vid_obj, source) {
|
|||
removeTracks();
|
||||
for (i = 0; i < source.length; i++) {
|
||||
if (source[i].type) {
|
||||
console.log(source[i].type);
|
||||
if(source[i].type==="application/x-mpegURL"){
|
||||
// it is HLS cancel it
|
||||
return false;
|
||||
}
|
||||
srcs.push(source[i]);
|
||||
} else if (source[i].srclang) {
|
||||
player.addRemoteTextTrack(source[i]);
|
||||
|
@ -308,6 +315,7 @@ function changeVideoSrc(vid_obj, source) {
|
|||
setTimeout(function () {
|
||||
changeVideoSrcLoad();
|
||||
}, 1000);
|
||||
return true;
|
||||
}
|
||||
|
||||
function changeVideoSrcLoad() {
|
||||
|
@ -508,9 +516,11 @@ var promisePlayTimeout;
|
|||
var promisePlay;
|
||||
function playerPlay(currentTime) {
|
||||
if (userIsControling) { // stops here if the user already clicked on play or pause
|
||||
console.log("playerPlay: userIsControling");
|
||||
return true;
|
||||
}
|
||||
if (promisePlaytry <= 0) {
|
||||
console.log("playerPlay: promisePlaytry <= 0");
|
||||
return false;
|
||||
}
|
||||
promisePlaytry--;
|
||||
|
@ -530,6 +540,7 @@ function playerPlay(currentTime) {
|
|||
console.log("playerPlay: promise found");
|
||||
promisePlay.then(function () {
|
||||
console.log("playerPlay: Autoplay started");
|
||||
userIsControling = true;
|
||||
clearTimeout(promisePlayTimeout);
|
||||
setTimeout(function () {
|
||||
if (player.paused()) {
|
||||
|
@ -537,6 +548,7 @@ function playerPlay(currentTime) {
|
|||
player.muted(true);
|
||||
playerPlay(currentTime);
|
||||
} else {
|
||||
//player.muted(false);
|
||||
if (player.muted() && !inIframe()) {
|
||||
var donotShowUnmuteAgain = Cookies.get('donotShowUnmuteAgain');
|
||||
if (!donotShowUnmuteAgain) {
|
||||
|
@ -556,7 +568,7 @@ function playerPlay(currentTime) {
|
|||
className: "btn-danger",
|
||||
},
|
||||
}
|
||||
}).then(function(value) {
|
||||
}).then(function (value) {
|
||||
switch (value) {
|
||||
case "unmute":
|
||||
player.muted(false);
|
||||
|
@ -570,9 +582,11 @@ function playerPlay(currentTime) {
|
|||
}
|
||||
});
|
||||
}
|
||||
$("#mainVideo .vjs-volume-panel").attr("data-toggle","tooltip");
|
||||
$("#mainVideo .vjs-volume-panel").attr("title","Click to activate the sound");
|
||||
if ($("#mainVideo .vjs-volume-panel").length) {
|
||||
$("#mainVideo .vjs-volume-panel").attr("data-toggle", "tooltip");
|
||||
$("#mainVideo .vjs-volume-panel").attr("title", "Click to activate the sound");
|
||||
$('#mainVideo .vjs-volume-panel[data-toggle="tooltip"]').tooltip('show');
|
||||
}
|
||||
player.userActive(true);
|
||||
setTimeout(function () {
|
||||
player.userActive(true);
|
||||
|
@ -612,20 +626,60 @@ function playerPlay(currentTime) {
|
|||
}
|
||||
}
|
||||
|
||||
function playerPlayIfAutoPlay(currentTime){
|
||||
if(isAutoplayEnabled()){
|
||||
function playerPlayIfAutoPlay(currentTime) {
|
||||
if (isAutoplayEnabled()) {
|
||||
playerPlay(currentTime);
|
||||
return true;
|
||||
}
|
||||
setCurrentTime(currentTime);
|
||||
//$.toast("Autoplay disabled");
|
||||
return false;
|
||||
}
|
||||
|
||||
function playNext(url){
|
||||
if (isPlayNextEnabled()) {
|
||||
function playNext(url) {
|
||||
if(isPlayingAds()){
|
||||
setTimeout(function(){playNext(url);},1000);
|
||||
}else if (isPlayNextEnabled()) {
|
||||
modal.showPleaseWait();
|
||||
if (typeof autoPlayAjax == 'undefined' || !autoPlayAjax) {
|
||||
console.log("playNext changing location "+url);
|
||||
document.location = url;
|
||||
}else if(isPlayerLoop()){
|
||||
} else {
|
||||
console.log("playNext ajax");
|
||||
$.ajax({
|
||||
url: webSiteRootURL + 'view/infoFromURL.php?url=' + encodeURI(url),
|
||||
success: function (response) {
|
||||
console.log(response);
|
||||
if (!response || response.error) {
|
||||
console.log("playNext ajax fail");
|
||||
//document.location = url;
|
||||
} else {
|
||||
console.log("playNext ajax success");
|
||||
$('topInfo').hide();
|
||||
playNextURL = isEmbed?response.nextURLEmbed:response.nextURL;
|
||||
console.log("New playNextURL", playNextURL);
|
||||
if(!changeVideoSrc(player, response.sources)){
|
||||
document.location = url;
|
||||
return false;
|
||||
}
|
||||
$('video, #mainVideo').attr('poster', response.poster);
|
||||
history.pushState(null, null, url);
|
||||
$('.vjs-thumbnail-holder, .vjs-thumbnail-holder img').attr('src', response.sprits);
|
||||
modal.hidePleaseWait();
|
||||
if ($('#modeYoutubeBottom').length) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
success: function (response) {
|
||||
modeYoutubeBottom = $(response).find('#modeYoutubeBottom').html();
|
||||
$('#modeYoutubeBottom').html(modeYoutubeBottom);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (isPlayerLoop()) {
|
||||
$.toast("Looping video");
|
||||
userIsControling = false;
|
||||
playerPlay(0);
|
||||
|
@ -649,8 +703,10 @@ function tooglePlayerLoop() {
|
|||
var setPlayerLoopSetTimeout;
|
||||
function setPlayerLoop(loop) {
|
||||
clearTimeout(setPlayerLoopSetTimeout);
|
||||
if(typeof player === 'undefined'){
|
||||
setPlayerLoopSetTimeout = setTimeout(function(){setPlayerLoop(loop)},1000);
|
||||
if (typeof player === 'undefined') {
|
||||
setPlayerLoopSetTimeout = setTimeout(function () {
|
||||
setPlayerLoop(loop)
|
||||
}, 1000);
|
||||
return false;
|
||||
}
|
||||
if (loop) {
|
||||
|
@ -693,6 +749,9 @@ function toogleImageLoop(t) {
|
|||
}
|
||||
|
||||
function isPlayerLoop() {
|
||||
if(typeof player === 'undefined'){
|
||||
return false;
|
||||
}
|
||||
var loop = Cookies.get('playerLoop');
|
||||
if (!loop || loop === "false") {
|
||||
return player.loop();
|
||||
|
@ -714,7 +773,6 @@ var initdone = false;
|
|||
function setCurrentTime(currentTime) {
|
||||
if (typeof player !== 'undefined') {
|
||||
player.currentTime(currentTime);
|
||||
playerPlayIfAutoPlay(currentTime);
|
||||
initdone = false;
|
||||
// wait for video metadata to load, then set time
|
||||
player.on("loadedmetadata", function () {
|
||||
|
@ -735,51 +793,58 @@ function setCurrentTime(currentTime) {
|
|||
}
|
||||
}
|
||||
|
||||
function isAutoplayEnabled(){
|
||||
if($("#autoplay").length && $("#autoplay").is(':visible')){
|
||||
function isAutoplayEnabled() {
|
||||
console.log("Cookies.get('autoplay')", Cookies.get('autoplay'));
|
||||
if ($("#autoplay").length && $("#autoplay").is(':visible')) {
|
||||
autoplay = $("#autoplay").is(":checked");
|
||||
Cookies.set('autoplay', autoplay, {
|
||||
path: '/',
|
||||
expires: 365
|
||||
});
|
||||
console.log("isAutoplayEnabled #autoplay said "+(autoplay)?"Yes":"No");
|
||||
console.log("isAutoplayEnabled #autoplay said " + ((autoplay) ? "Yes" : "No"));
|
||||
setAutoplay(autoplay);
|
||||
return autoplay;
|
||||
}else if (
|
||||
} else if (
|
||||
typeof Cookies !== 'undefined' &&
|
||||
(typeof isEmbed === 'undefined' || !isEmbed) &&
|
||||
typeof Cookies.get('autoplay') !== 'undefined' &&
|
||||
Cookies.get('autoplay')
|
||||
typeof Cookies.get('autoplay') !== 'undefined'
|
||||
) {
|
||||
if(Cookies.get('autoplay') === 'true' || Cookies.get('autoplay') == true){
|
||||
if (Cookies.get('autoplay') === 'true' || Cookies.get('autoplay') == true) {
|
||||
console.log("isAutoplayEnabled Cookie said Yes ");
|
||||
setAutoplay(true);
|
||||
return true;
|
||||
}else{
|
||||
} else {
|
||||
console.log("isAutoplayEnabled Cookie said No ");
|
||||
setAutoplay(false);
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
if(typeof autoplay !== 'undefined'){
|
||||
console.log("isAutoplayEnabled #autoplay said "+(autoplay)?"Yes":"No");
|
||||
} else {
|
||||
if (typeof autoplay !== 'undefined') {
|
||||
console.log("isAutoplayEnabled autoplay said " + ((autoplay) ? "Yes" : "No"));
|
||||
setAutoplay(autoplay);
|
||||
return autoplay;
|
||||
}
|
||||
}
|
||||
setAutoplay(false);
|
||||
console.log("isAutoplayEnabled Default is No ");
|
||||
return false;
|
||||
}
|
||||
|
||||
function isPlayNextEnabled(){
|
||||
function setAutoplay(value) {
|
||||
Cookies.set('autoplay', value, {
|
||||
path: '/',
|
||||
expires: 365
|
||||
});
|
||||
}
|
||||
|
||||
function isPlayNextEnabled() {
|
||||
if (isPlayerLoop()) {
|
||||
return false;
|
||||
}else if(isAutoplayEnabled()){
|
||||
} else if (isAutoplayEnabled()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function avideoAlert(title, msg, type){
|
||||
if(msg !== msg.replace(/<\/?[^>]+(>|$)/g, "")){//it has HTML
|
||||
function avideoAlert(title, msg, type) {
|
||||
if (msg !== msg.replace(/<\/?[^>]+(>|$)/g, "")) {//it has HTML
|
||||
avideoAlertHTMLText(title, msg, type);
|
||||
}else{
|
||||
} else {
|
||||
swal(title, msg, type);
|
||||
}
|
||||
}
|
||||
|
@ -797,19 +862,37 @@ function avideoAlertHTMLText(title, msg, type) {
|
|||
});
|
||||
}
|
||||
|
||||
function avideoAlertInfo(msg){
|
||||
function avideoAlertInfo(msg) {
|
||||
avideoAlert("Info", msg, 'info');
|
||||
}
|
||||
function avideoAlertError(msg){
|
||||
function avideoAlertError(msg) {
|
||||
avideoAlert("Error", msg, 'error');
|
||||
}
|
||||
function avideoAlertSuccess(msg){
|
||||
function avideoAlertSuccess(msg) {
|
||||
avideoAlert("Success", msg, 'success');
|
||||
}
|
||||
|
||||
function avideoTooltip(selector, text){
|
||||
function avideoTooltip(selector, text) {
|
||||
$(selector).attr('title', text);
|
||||
$(selector).attr('data-toggle', 'tooltip');
|
||||
$(selector).attr('data-original-title', text);
|
||||
$(selector).tooltip();
|
||||
}
|
||||
|
||||
function fixAdSize(){
|
||||
ad_container = $('#mainVideo_ima-ad-container');
|
||||
if(ad_container.length){
|
||||
height = ad_container.css('height');
|
||||
width = ad_container.css('width');
|
||||
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({'height': height});
|
||||
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({'width': width});
|
||||
}
|
||||
}
|
||||
|
||||
function isPlayingAds(){
|
||||
return ($("#mainVideo_ima-ad-container").length && $("#mainVideo_ima-ad-container").is(':visible'));
|
||||
}
|
||||
|
||||
function playerHasAds(){
|
||||
return ($("#mainVideo_ima-ad-container").length>0);
|
||||
}
|
|
@ -426,13 +426,6 @@ if (!empty($video['users_id']) && User::hasBlockedUser($video['users_id'])) {
|
|||
<script src="<?php echo $jsURL; ?>" type="text/javascript"></script>
|
||||
<script>
|
||||
var fading = false;
|
||||
var autoPlaySources = <?php echo json_encode($autoPlaySources); ?>;
|
||||
var autoPlayURL = '<?php echo $autoPlayURL; ?>';
|
||||
var autoPlayPoster = '<?php echo $autoPlayPoster; ?>';
|
||||
var autoPlayThumbsSprit = '<?php echo $autoPlayThumbsSprit; ?>';
|
||||
|
||||
$(document).ready(function () {
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -12,10 +12,7 @@ if (!empty($playlist_id)) {
|
|||
?>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
Cookies.set('autoplay', true, {
|
||||
path: '/',
|
||||
expires: 365
|
||||
});
|
||||
setAutoplay(true);
|
||||
});
|
||||
</script>
|
||||
<?php } else if (empty($autoPlayVideo)) {
|
||||
|
@ -169,15 +166,7 @@ $modeYouTubeTime = microtime(true);
|
|||
});
|
||||
|
||||
if (isAutoplayEnabled()) {
|
||||
<?php if ($config->getAutoplay()) { ?>
|
||||
$("#autoplay").prop('checked', true);
|
||||
Cookies.set('autoplay', true, {
|
||||
path: '/',
|
||||
expires: 365
|
||||
});
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
}
|
||||
|
||||
$("#autoplay").change(function () {
|
||||
|
|
|
@ -159,7 +159,7 @@ if (User::hasBlockedUser($video['users_id'])) {
|
|||
?>
|
||||
<script>
|
||||
var isEmbed = true;
|
||||
var autoplay = <?php echo $autoplay?"true":"false"; ?>;
|
||||
var autoplay = <?php echo $autoplay ? "true" : "false"; ?>;
|
||||
var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>';
|
||||
</script>
|
||||
<meta charset="utf-8">
|
||||
|
@ -434,32 +434,7 @@ if (User::hasBlockedUser($video['users_id'])) {
|
|||
?>
|
||||
<script>
|
||||
<?php
|
||||
$onPlayerReady = "player.on('play', function () {addView({$video['id']}, this.currentTime());});";
|
||||
$onPlayerReady .= "player.on('timeupdate', function () {
|
||||
var time = Math.round(this.currentTime());
|
||||
var url = '" . Video::getURLFriendly($video['id']) . "';
|
||||
if (url.indexOf('?') > -1) {
|
||||
url += '&t=' + time;
|
||||
} else {
|
||||
url += '?t=' + time;
|
||||
}
|
||||
$('#linkCurrentTime').val(url);
|
||||
if (time >= 5 && time % 5 === 0) {
|
||||
addView({$video['id']}, time);
|
||||
}
|
||||
});";
|
||||
|
||||
if ($autoplay) {
|
||||
$onPlayerReady .= "playerPlay({$currentTime});";
|
||||
} else {
|
||||
$onPlayerReady .= "setCurrentTime({$currentTime});";
|
||||
}
|
||||
$onPlayerReady .= "player.on('ended', function () {console.log(\"Finish Video\");
|
||||
var time = Math.round(this.currentTime());
|
||||
addView({$video['id']}, time);";
|
||||
$onPlayerReady .= "});";
|
||||
|
||||
echo PlayerSkins::getStartPlayerJS($onPlayerReady);
|
||||
PlayerSkins::playerJSCodeOnLoad($video['id']);
|
||||
?>
|
||||
</script>
|
||||
<?php
|
||||
|
@ -491,33 +466,7 @@ addView({$video['id']}, time);";
|
|||
?>
|
||||
|
||||
<script><?php
|
||||
$onPlayerReady = "";
|
||||
$onPlayerReady = "player.on('play', function () {addView({$video['id']}, this.currentTime());});";
|
||||
$onPlayerReady .= "player.on('timeupdate', function () {
|
||||
var time = Math.round(this.currentTime());
|
||||
var url = '" . Video::getURLFriendly($video['id']) . "';
|
||||
if (url.indexOf('?') > -1) {
|
||||
url += '&t=' + time;
|
||||
} else {
|
||||
url += '?t=' + time;
|
||||
}
|
||||
$('#linkCurrentTime').val(url);
|
||||
if (time >= 5 && time % 5 === 0) {
|
||||
addView({$video['id']}, time);
|
||||
}
|
||||
});";
|
||||
|
||||
if ($autoplay) {
|
||||
$onPlayerReady .= "playerPlay({$currentTime});";
|
||||
} else {
|
||||
$onPlayerReady .= "setCurrentTime({$currentTime});";
|
||||
}
|
||||
$onPlayerReady .= "player.on('ended', function () {console.log(\"Finish Video\");
|
||||
var time = Math.round(this.currentTime());
|
||||
addView({$video['id']}, time);";
|
||||
$onPlayerReady .= "});";
|
||||
|
||||
echo PlayerSkins::getStartPlayerJS($onPlayerReady);
|
||||
PlayerSkins::playerJSCodeOnLoad($video['id']);
|
||||
?>
|
||||
</script>
|
||||
<?php
|
||||
|
@ -544,7 +493,6 @@ addView({$video['id']}, time);";
|
|||
<?php
|
||||
echo AVideoPlugin::afterVideoJS();
|
||||
$jsFiles = array();
|
||||
$jsFiles[] = "view/bootstrap/js/bootstrap.min.js";
|
||||
$jsFiles[] = "view/js/BootstrapMenu.min.js";
|
||||
$jsFiles[] = "view/js/seetalert/sweetalert.min.js";
|
||||
$jsFiles[] = "view/js/bootpag/jquery.bootpag.min.js";
|
||||
|
@ -557,6 +505,7 @@ addView({$video['id']}, time);";
|
|||
$jsFiles[] = "view/js/jquery.lazy/jquery.lazy.plugins.min.js";
|
||||
$jsFiles[] = "view/js/jquery-ui/jquery-ui.min.js";
|
||||
$jsFiles[] = "view/js/jquery-toast/jquery.toast.min.js";
|
||||
$jsFiles[] = "view/bootstrap/js/bootstrap.min.js";
|
||||
$jsURL = combineFiles($jsFiles, "js");
|
||||
?>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>view/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
||||
|
@ -579,12 +528,13 @@ addView({$video['id']}, time);";
|
|||
var topInfoTimeout;
|
||||
$(document).ready(function () {
|
||||
setInterval(function () {
|
||||
if(typeof player !== 'undefined'){
|
||||
if (!player.paused() && (!$('.vjs-control-bar').is(":visible") || $('.vjs-control-bar').css('opacity') == "0")) {
|
||||
$('#topInfo').fadeOut();
|
||||
} else {
|
||||
$('#topInfo').fadeIn();
|
||||
}
|
||||
|
||||
}
|
||||
}, 200);
|
||||
|
||||
$("iframe, #topInfo").mouseover(function (e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue