mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
Getting ready for the Live Stream Multiple servers
This commit is contained in:
parent
945890ee14
commit
5c52709d6c
60 changed files with 1868 additions and 632 deletions
|
@ -0,0 +1 @@
|
|||
{"error":true,"msg":"Empty filename","aVideoStorageURL":"http:\/\/ubuntu.gdrive.local\/YouPHPTube-Storage\/","filename":""}
|
|
@ -325,14 +325,30 @@ class AVideoPlugin {
|
|||
}
|
||||
|
||||
static function getObjectData($name) {
|
||||
return self::getDataObject($name);
|
||||
}
|
||||
|
||||
static function getDataObject($name) {
|
||||
global $pluginGetDataObject;
|
||||
if(!isset($pluginGetDataObject)){
|
||||
$pluginGetDataObject = array();
|
||||
}
|
||||
if(!empty($pluginGetDataObject[$name])){
|
||||
return $pluginGetDataObject[$name];
|
||||
}
|
||||
$p = static::loadPlugin($name);
|
||||
if ($p) {
|
||||
return $p->getDataObject();
|
||||
$pluginGetDataObject[$name] = $p->getDataObject();
|
||||
return $pluginGetDataObject[$name];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static function getObjectDataIfEnabled($name) {
|
||||
return self::getDataObjectIfEnabled($name);
|
||||
}
|
||||
|
||||
static function getDataObjectIfEnabled($name) {
|
||||
$p = static::loadPlugin($name);
|
||||
if ($p) {
|
||||
$uuid = $p->getUUID();
|
||||
|
|
|
@ -204,10 +204,10 @@ class CustomizeAdvanced extends PluginAbstract {
|
|||
if ($obj->disableNavBarInsideIframe) {
|
||||
$content .= '<script>$(function () {if(inIframe()){$("#mainNavBar").fadeOut();}});</script>';
|
||||
}
|
||||
if ($obj->autoHideNavbar) {
|
||||
if ($obj->autoHideNavbar && !isEmbed()) {
|
||||
$content .= '<script>$(function () {setTimeout(function(){$("#mainNavBar").autoHidingNavbar();},5000);});</script>';
|
||||
}
|
||||
if ($obj->autoHideNavbarInSeconds) {
|
||||
if ($obj->autoHideNavbarInSeconds && !isEmbed()) {
|
||||
$content .= '<script>'
|
||||
. 'var autoHidingNavbarTimeoutMiliseconds = '.intval($obj->autoHideNavbarInSeconds*1000).';'
|
||||
.file_get_contents($global['systemRootPath'] . 'plugin/CustomizeAdvanced/autoHideNavbarInSeconds.js')
|
||||
|
|
|
@ -12,6 +12,7 @@ function autoHideNavbar() {
|
|||
}, autoHidingNavbarTimeoutMiliseconds);
|
||||
}
|
||||
$(function () {
|
||||
if ($("#mainNavBar").length) {
|
||||
autoHideNavbar();
|
||||
$("#mainNavBar").mouseover(function () {
|
||||
//console.log("clearTimeout autoHidingNavbar");
|
||||
|
@ -32,4 +33,5 @@ $(function () {
|
|||
$("#mainNavBar").on("hide.autoHidingNavbar", function () {
|
||||
$('body').addClass('nopadding');
|
||||
});
|
||||
}
|
||||
});
|
|
@ -4,6 +4,10 @@ global $global;
|
|||
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
|
||||
require_once $global['systemRootPath'] . 'plugin/Live/Objects/LiveTransmitionHistory.php';
|
||||
require_once $global['systemRootPath'] . 'plugin/Live/Objects/LiveTransmitionHistoryLog.php';
|
||||
require_once $global['systemRootPath'] . 'plugin/Live/Objects/Live_servers.php';
|
||||
|
||||
$getStatsObject = array();
|
||||
$_getStats = array();
|
||||
|
||||
class Live extends PluginAbstract {
|
||||
|
||||
|
@ -27,7 +31,7 @@ class Live extends PluginAbstract {
|
|||
}
|
||||
|
||||
public function getPluginVersion() {
|
||||
return "3.0";
|
||||
return "4.0";
|
||||
}
|
||||
|
||||
public function updateScript() {
|
||||
|
@ -45,7 +49,17 @@ class Live extends PluginAbstract {
|
|||
$fetch = sqlDAL::fetchAssoc($res);
|
||||
if (!$fetch) {
|
||||
sqlDal::writeSql(file_get_contents($global['systemRootPath'] . 'plugin/Live/install/updateV3.0.sql'));
|
||||
return true;
|
||||
}
|
||||
//update version 4.0
|
||||
$sql = "SELECT 1 FROM live_servers LIMIT 1";
|
||||
$res = sqlDAL::readSql($sql);
|
||||
$fetch = sqlDAL::fetchAssoc($res);
|
||||
if (!$fetch) {
|
||||
$sqls = file_get_contents($global['systemRootPath'] . 'plugin/Live/install/updateV4.0.sql');
|
||||
$sqlParts = explode(";", $sqls);
|
||||
foreach ($sqlParts as $value) {
|
||||
sqlDal::writeSql(trim($value));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -65,8 +79,6 @@ class Live extends PluginAbstract {
|
|||
$obj->button_title = "LIVE";
|
||||
$obj->server = "rtmp://{$server['host']}/live";
|
||||
$obj->playerServer = "{$scheme}://{$server['host']}:{$port}/live";
|
||||
// for secure connections
|
||||
//$obj->playerServer = "https://{$server['host']}:444/live";
|
||||
$obj->stats = "{$scheme}://{$server['host']}:{$port}/stat";
|
||||
$obj->disableDVR = false;
|
||||
$obj->disableGifThumbs = false;
|
||||
|
@ -76,7 +88,11 @@ class Live extends PluginAbstract {
|
|||
$obj->doNotShowLiveOnVideosList = false;
|
||||
$obj->doNotShowGoLiveButton = false;
|
||||
$obj->doNotProcessNotifications = false;
|
||||
$obj->useLiveServers = false;
|
||||
$obj->hls_path = "/HLS/live";
|
||||
$obj->requestStatsTimout = 4; // if the server does not respond we stop wait
|
||||
$obj->cacheStatsTimout = 15; // we will cache the result
|
||||
$obj->requestStatsInterval = 15; // how many seconds untill request the stats again
|
||||
return $obj;
|
||||
}
|
||||
|
||||
|
@ -90,17 +106,72 @@ class Live extends PluginAbstract {
|
|||
return $o->key;
|
||||
}
|
||||
|
||||
public function getServer() {
|
||||
$o = $this->getDataObject();
|
||||
return $o->server;
|
||||
static function getServer() {
|
||||
$obj = AVideoPlugin::getObjectData("Live");
|
||||
if (!empty($obj->useLiveServers)) {
|
||||
$ls = new Live_servers(self::getCurrentLiveServersId());
|
||||
if(!empty($ls->getRtmp_server())){
|
||||
return $ls->getRtmp_server();
|
||||
}
|
||||
}
|
||||
return $obj->server;
|
||||
}
|
||||
|
||||
public function getM3U8File($uuid) {
|
||||
static function getPlayerServer() {
|
||||
$obj = AVideoPlugin::getObjectData("Live");
|
||||
if (!empty($obj->useLiveServers)) {
|
||||
$ls = new Live_servers(self::getCurrentLiveServersId());
|
||||
if(!empty($ls->getPlayerServer())){
|
||||
return $ls->getPlayerServer();
|
||||
}
|
||||
}
|
||||
return $obj->playerServer;
|
||||
}
|
||||
|
||||
static function getUseAadaptiveMode() {
|
||||
$obj = AVideoPlugin::getObjectData("Live");
|
||||
if (!empty($obj->useLiveServers)) {
|
||||
$ls = new Live_servers(self::getCurrentLiveServersId());
|
||||
return $ls->getUseAadaptiveMode();
|
||||
}
|
||||
return $obj->useAadaptiveMode;
|
||||
}
|
||||
|
||||
static function getRemoteFile() {
|
||||
$obj = AVideoPlugin::getObjectData("Live");
|
||||
if (!empty($obj->useLiveServers)) {
|
||||
$ls = new Live_servers(self::getCurrentLiveServersId());
|
||||
return $ls->getGetRemoteFile();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static function getRemoteFileFromRTMPHost($rtmpHostURI) {
|
||||
$obj = AVideoPlugin::getObjectData("Live");
|
||||
if (!empty($obj->useLiveServers)) {
|
||||
$live_servers_id = Live_servers::getServerIdFromRTMPHost($rtmpHostURI);
|
||||
if($live_servers_id){
|
||||
$ls = new Live_servers($live_servers_id);
|
||||
return $ls->getGetRemoteFile();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static function getLiveServersIdRequest() {
|
||||
if(empty($_REQUEST['live_servers_id'])){
|
||||
return 0;
|
||||
}
|
||||
return intval($_REQUEST['live_servers_id']);
|
||||
}
|
||||
|
||||
static function getM3U8File($uuid) {
|
||||
global $global;
|
||||
$o = $this->getDataObject();
|
||||
$playerServer = $o->playerServer;
|
||||
$o = AVideoPlugin::getObjectData("Live");
|
||||
$playerServer = self::getPlayerServer();
|
||||
$live_servers_id = self::getLiveServersIdRequest();
|
||||
if ($o->protectLive) {
|
||||
return "{$global['webSiteRootURL']}plugin/Live/m3u8.php?uuid=". encryptString($uuid);
|
||||
return "{$global['webSiteRootURL']}plugin/Live/m3u8.php?live_servers_id={$live_servers_id}&uuid=" . encryptString($uuid);
|
||||
} else if ($o->useAadaptiveMode) {
|
||||
return $playerServer . "/{$uuid}.m3u8";
|
||||
} else {
|
||||
|
@ -113,8 +184,15 @@ class Live extends PluginAbstract {
|
|||
return $o->disableGifThumbs;
|
||||
}
|
||||
|
||||
public function getStatsURL() {
|
||||
public function getStatsURL($live_servers_id = 0) {
|
||||
global $global;
|
||||
$o = $this->getDataObject();
|
||||
if (!empty($live_servers_id)) {
|
||||
$liveServer = new Live_servers($live_servers_id);
|
||||
if ($liveServer->getStats_url()) {
|
||||
return $liveServer->getStats_url();
|
||||
}
|
||||
}
|
||||
return $o->stats;
|
||||
}
|
||||
|
||||
|
@ -128,7 +206,11 @@ class Live extends PluginAbstract {
|
|||
}
|
||||
}
|
||||
|
||||
function getStatsObject() {
|
||||
function getStatsObject($live_servers_id = 0) {
|
||||
global $getStatsObject;
|
||||
if(!empty($getStatsObject[$live_servers_id])){
|
||||
return $getStatsObject[$live_servers_id];
|
||||
}
|
||||
$o = $this->getDataObject();
|
||||
if ($o->doNotProcessNotifications) {
|
||||
$xml = new stdClass();
|
||||
|
@ -136,13 +218,48 @@ class Live extends PluginAbstract {
|
|||
$xml->server->application = array();
|
||||
return $xml;
|
||||
}
|
||||
if(empty($o->requestStatsTimout)){
|
||||
$o->requestStatsTimout = 2;
|
||||
}
|
||||
ini_set('allow_url_fopen ', 'ON');
|
||||
$xml = simplexml_load_string($this->get_data($this->getStatsURL()));
|
||||
$url = $this->getStatsURL($live_servers_id);
|
||||
if(!empty($_SESSION['getStatsObjectRequestStatsTimout'][$url])){
|
||||
_error_log("Live::getStatsObject RTMP Server ($url) is NOT responding we will wait less from now on => live_servers_id = ($live_servers_id) ");
|
||||
// if the server already fail, do not wait mutch for it next time, just wait 0.5 seconds
|
||||
$o->requestStatsTimout = $_SESSION['getStatsObjectRequestStatsTimout'][$url];
|
||||
}
|
||||
$data = $this->get_data($url, $o->requestStatsTimout);
|
||||
if(empty($data)){
|
||||
if(empty($_SESSION['getStatsObjectRequestStatsTimout'][$url])){
|
||||
// the server fail to respont, just wait 0.5 seconds until it respond again
|
||||
_session_start();
|
||||
if(empty($_SESSION['getStatsObjectRequestStatsTimout'])){
|
||||
$_SESSION['getStatsObjectRequestStatsTimout'] = array();
|
||||
}
|
||||
$_SESSION['getStatsObjectRequestStatsTimout'][$url] = 0.5;
|
||||
}
|
||||
_error_log("Live::getStatsObject RTMP Server ($url) is OFFLINE, we could not connect on it => live_servers_id = ($live_servers_id) ", AVideoLog::$ERROR);
|
||||
$data = '<?xml version="1.0" encoding="utf-8" ?><?xml-stylesheet type="text/xsl" href="stat.xsl" ?><rtmp><server><application><name>The RTMP Server is Unavailable</name><live><nclients>0</nclients></live></application></server></rtmp>';
|
||||
}else{
|
||||
if(!empty($_SESSION['getStatsObjectRequestStatsTimout'][$url])){
|
||||
_error_log("Live::getStatsObject RTMP Server ($url) is respond again => live_servers_id = ($live_servers_id) ");
|
||||
// the server respont again, wait the default time
|
||||
$_SESSION['getStatsObjectRequestStatsTimout'][$url] = 0;
|
||||
unset($_SESSION['getStatsObjectRequestStatsTimout'][$url]);
|
||||
}
|
||||
}
|
||||
$xml = simplexml_load_string($data);
|
||||
$getStatsObject[$live_servers_id] = $xml;
|
||||
return $xml;
|
||||
}
|
||||
|
||||
function get_data($url) {
|
||||
return url_get_contents($url, "", 5);
|
||||
function get_data($url, $timeout) {
|
||||
try {
|
||||
return @url_get_contents($url, "", $timeout);
|
||||
} catch (Exception $exc) {
|
||||
_error_log($exc->getTraceAsString());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getTags() {
|
||||
|
@ -175,7 +292,6 @@ class Live extends PluginAbstract {
|
|||
return "liveui: true";
|
||||
}
|
||||
|
||||
|
||||
static function stopLive($users_id) {
|
||||
if (!User::isAdmin() && User::getId() != $users_id) {
|
||||
return false;
|
||||
|
@ -186,7 +302,8 @@ class Live extends PluginAbstract {
|
|||
$lt = new LiveTransmition(0);
|
||||
$lt->loadByUser($users_id);
|
||||
$key = $lt->getKey();
|
||||
$url = "{$server}control/drop/publisher?app=live&name=$key";
|
||||
$appName = self::getApplicationName();
|
||||
$url = "{$server}control/drop/publisher?app={$appName}&name=$key";
|
||||
url_get_contents($url);
|
||||
$dir = $obj->hls_path . "/$key";
|
||||
if (is_dir($dir)) {
|
||||
|
@ -207,11 +324,22 @@ class Live extends PluginAbstract {
|
|||
$lt = new LiveTransmition(0);
|
||||
$lt->loadByUser($users_id);
|
||||
$key = $lt->getKey();
|
||||
$url = "{$server}control/record/start?app=live&name=$key";
|
||||
$appName = self::getApplicationName();
|
||||
$url = "{$server}control/record/start?app={$appName}&name=$key";
|
||||
url_get_contents($url);
|
||||
}
|
||||
}
|
||||
|
||||
static function getApplicationName() {
|
||||
$obj = AVideoPlugin::getObjectData('Live');
|
||||
$parts = explode("/", $obj->playerServer);
|
||||
$live = end($parts);
|
||||
|
||||
if (empty($live)) {
|
||||
$live = "live";
|
||||
}
|
||||
return $live;
|
||||
}
|
||||
|
||||
// not implemented yet
|
||||
static function stopRecording($users_id) {
|
||||
|
@ -224,7 +352,8 @@ class Live extends PluginAbstract {
|
|||
$lt = new LiveTransmition(0);
|
||||
$lt->loadByUser($users_id);
|
||||
$key = $lt->getKey();
|
||||
$url = "{$server}control/record/stop?app=live&name=$key";
|
||||
$appName = self::getApplicationName();
|
||||
$url = "{$server}control/record/stop?app={$appName}&name=$key";
|
||||
url_get_contents($url);
|
||||
}
|
||||
}
|
||||
|
@ -238,7 +367,27 @@ class Live extends PluginAbstract {
|
|||
if (empty($user)) {
|
||||
return false;
|
||||
}
|
||||
return "{$global['webSiteRootURL']}plugin/Live/?c=".urlencode($user->getChannelName());
|
||||
$ls = self::getCurrentLiveServersId();
|
||||
return "{$global['webSiteRootURL']}plugin/Live/?live_servers_id={$ls}&c=" . urlencode($user->getChannelName());
|
||||
}
|
||||
|
||||
static function getAvailableLiveServersId(){
|
||||
$ls = self::getAvailableLiveServer();
|
||||
if(empty($ls)){
|
||||
return 0;
|
||||
}else{
|
||||
return intval($ls->live_servers_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static function getCurrentLiveServersId(){
|
||||
$live_servers_id = self::getLiveServersIdRequest();
|
||||
if($live_servers_id){
|
||||
return $live_servers_id;
|
||||
}else{
|
||||
return self::getAvailableLiveServersId();
|
||||
}
|
||||
}
|
||||
|
||||
public function getVideosManagerListButtonTitle() {
|
||||
|
@ -250,4 +399,155 @@ class Live extends PluginAbstract {
|
|||
return $btn;
|
||||
}
|
||||
|
||||
public function getPluginMenu() {
|
||||
global $global;
|
||||
return '<a href="plugin/Live/View/editor.php" class="btn btn-primary btn-sm btn-xs btn-block"><i class="fa fa-edit"></i> Edit Live Servers</a>';
|
||||
}
|
||||
|
||||
static function getStats() {
|
||||
$obj = AVideoPlugin::getObjectData("Live");
|
||||
if (empty($obj->useLiveServers)) {
|
||||
return self::_getStats(0);
|
||||
} else if (!empty(Live::getLiveServersIdRequest())) {
|
||||
$ls = new Live_servers(Live::getLiveServersIdRequest());
|
||||
if(!empty($ls->getPlayerServer())){
|
||||
$server = self::_getStats($ls->getId());
|
||||
$server->live_servers_id = $ls->getId();
|
||||
$server->playerServer = $ls->getPlayerServer();
|
||||
return $server;
|
||||
}
|
||||
}
|
||||
$ls = Live_servers::getAllActive();
|
||||
$liveServers = array();
|
||||
$getLiveServersIdRequest = self::getLiveServersIdRequest();
|
||||
foreach ($ls as $value) {
|
||||
$server = Live_servers::getStatsFromId($value['id']);
|
||||
$server->live_servers_id = $value['id'];
|
||||
$server->playerServer = $value['playerServer'];
|
||||
|
||||
foreach ($server->applications as $key => $app) {
|
||||
$_REQUEST['live_servers_id'] = $value['id'];
|
||||
$server->applications[$key]['m3u8'] = self::getM3U8File($app['key']);
|
||||
}
|
||||
|
||||
$liveServers[] = $server;
|
||||
}
|
||||
$_REQUEST['live_servers_id'] = $getLiveServersIdRequest;
|
||||
return $liveServers;
|
||||
}
|
||||
|
||||
static function getAllServers() {
|
||||
$obj = AVideoPlugin::getObjectData("Live");
|
||||
if (empty($obj->useLiveServers)) {
|
||||
return array("id"=> 0, "name"=> __("Default"), "status"=> "a", "rtmp_server"=> $obj->server, 'playerServer'=> $obj->playerServer, "stats_url"=> $obj->stats, "disableDVR"=> $obj->disableDVR, "disableGifThumbs"=> $obj->disableGifThumbs, "useAadaptiveMode"=> $obj->useAadaptiveMode, "protectLive"=> $obj->protectLive, "getRemoteFile"=>"");
|
||||
} else {
|
||||
return Live_servers::getAllActive();
|
||||
}
|
||||
}
|
||||
|
||||
static function getAvailableLiveServer() {
|
||||
$obj = AVideoPlugin::getObjectData("Live");
|
||||
if (empty($obj->useLiveServers)) {
|
||||
return false;
|
||||
} else {
|
||||
$liveServers = self::getStats();
|
||||
usort($liveServers, function($a, $b) {
|
||||
if ($a->countLiveStream == $b->countLiveStream) {
|
||||
return 0;
|
||||
}
|
||||
return ($a->countLiveStream < $b->countLiveStream) ? -1 : 1;
|
||||
});
|
||||
return $liveServers[0];
|
||||
}
|
||||
}
|
||||
|
||||
static function _getStats($live_servers_id = 0) {
|
||||
global $global, $_getStats;
|
||||
if(!empty($_getStats[$live_servers_id])){
|
||||
return $_getStats[$live_servers_id];
|
||||
}
|
||||
session_write_close();
|
||||
$obj = new stdClass();
|
||||
$obj->error = true;
|
||||
$obj->msg = "OFFLINE";
|
||||
$obj->nclients = 0;
|
||||
$obj->applications = array();
|
||||
if (empty($_POST['name']) && !empty($_GET['name'])) {
|
||||
$_POST['name'] = $_GET['name'];
|
||||
} else if (empty($_POST['name'])) {
|
||||
$_POST['name'] = "undefined";
|
||||
}
|
||||
$obj->name = $_POST['name'];
|
||||
$liveUsersEnabled = AVideoPlugin::isEnabledByName("LiveUsers");
|
||||
$p = AVideoPlugin::loadPlugin("Live");
|
||||
$xml = $p->getStatsObject($live_servers_id);
|
||||
$xml = json_encode($xml);
|
||||
$xml = json_decode($xml);
|
||||
|
||||
$stream = false;
|
||||
$lifeStream = array();
|
||||
//$obj->server = $xml->server;
|
||||
if (!empty($xml->server->application) && !is_array($xml->server->application)) {
|
||||
$application = $xml->server->application;
|
||||
$xml->server->application = array();
|
||||
$xml->server->application[] = $application;
|
||||
}
|
||||
foreach ($xml->server->application as $key => $application) {
|
||||
if (!empty($application->live->stream)) {
|
||||
if (empty($lifeStream)) {
|
||||
$lifeStream = array();
|
||||
}
|
||||
$lifeStream[] = $application->live->stream;
|
||||
}
|
||||
}
|
||||
|
||||
$obj->disableGif = $p->getDisableGifThumbs();
|
||||
$obj->countLiveStream = count($lifeStream);
|
||||
foreach ($lifeStream as $value) {
|
||||
if (!empty($value->name)) {
|
||||
$row = LiveTransmition::keyExists($value->name);
|
||||
if (!empty($row) && $value->name === $_POST['name']) {
|
||||
$obj->msg = "ONLINE";
|
||||
}
|
||||
if (empty($row) || empty($row['public'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$users = false;
|
||||
if ($liveUsersEnabled) {
|
||||
$filename = $global['systemRootPath'] . 'plugin/LiveUsers/Objects/LiveOnlineUsers.php';
|
||||
if (file_exists($filename)) {
|
||||
require_once $filename;
|
||||
$liveUsers = new LiveOnlineUsers(0);
|
||||
$users = $liveUsers->getUsersFromTransmitionKey($value->name, $live_servers_id);
|
||||
}
|
||||
}
|
||||
|
||||
$u = new User($row['users_id']);
|
||||
if ($u->getStatus() !== 'a') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$userName = $u->getNameIdentificationBd();
|
||||
$user = $u->getUser();
|
||||
$channelName = $u->getChannelName();
|
||||
$photo = $u->getPhotoDB();
|
||||
$UserPhoto = $u->getPhoto();
|
||||
$obj->applications[] = array("key" => $value->name, "users" => $users, "name" => $userName, "user" => $user, "photo" => $photo, "UserPhoto" => $UserPhoto, "title" => $row['title'], 'channelName' => $channelName);
|
||||
if ($value->name === $_POST['name']) {
|
||||
$obj->error = property_exists($value, 'publishing') ? false : true;
|
||||
$obj->msg = (!$obj->error) ? "ONLINE" : "Waiting for Streamer";
|
||||
$obj->stream = $value;
|
||||
$obj->nclients = intval($value->nclients);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$appArray = AVideoPlugin::getLiveApplicationArray();
|
||||
$obj->applications = array_merge($obj->applications, $appArray);
|
||||
$_getStats[$live_servers_id] = $obj;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ require_once dirname(__FILE__) . '/../../../objects/user.php';
|
|||
|
||||
class LiveTransmitionHistory extends ObjectYPT {
|
||||
|
||||
protected $id, $title, $description, $key, $created, $modified, $users_id;
|
||||
protected $id, $title, $description, $key, $created, $modified, $users_id, $live_servers_id;
|
||||
|
||||
static function getSearchFieldsNames() {
|
||||
return array('title', 'description');
|
||||
|
@ -76,6 +76,14 @@ class LiveTransmitionHistory extends ObjectYPT {
|
|||
$this->users_id = $users_id;
|
||||
}
|
||||
|
||||
function getLive_servers_id() {
|
||||
return intval($this->live_servers_id);
|
||||
}
|
||||
|
||||
function setLive_servers_id($live_servers_id) {
|
||||
$this->live_servers_id = intval($live_servers_id);
|
||||
}
|
||||
|
||||
function getAllFromUser($users_id){
|
||||
global $global;
|
||||
$sql = "SELECT * FROM " . static::getTableName() . " WHERE users_id = ? ";
|
||||
|
@ -115,6 +123,11 @@ class LiveTransmitionHistory extends ObjectYPT {
|
|||
|
||||
public function save() {
|
||||
AVideoPlugin::onLiveStream($this->users_id);
|
||||
|
||||
if(empty($this->live_servers_id)){
|
||||
$this->live_servers_id = 'NULL';
|
||||
}
|
||||
|
||||
return parent::save();
|
||||
}
|
||||
|
||||
|
|
181
plugin/Live/Objects/Live_servers.php
Normal file
181
plugin/Live/Objects/Live_servers.php
Normal file
|
@ -0,0 +1,181 @@
|
|||
<?php
|
||||
|
||||
require_once dirname(__FILE__) . '/../../../videos/configuration.php';
|
||||
|
||||
class Live_servers extends ObjectYPT {
|
||||
|
||||
protected $id, $name, $url, $status, $rtmp_server, $playerServer, $stats_url, $disableDVR, $disableGifThumbs, $useAadaptiveMode, $protectLive, $getRemoteFile;
|
||||
|
||||
static function getSearchFieldsNames() {
|
||||
return array('name', 'url', 'rtmp_server', 'playerServer', 'stats_url', 'getRemoteFile');
|
||||
}
|
||||
|
||||
static function getTableName() {
|
||||
return 'live_servers';
|
||||
}
|
||||
|
||||
function setId($id) {
|
||||
$this->id = intval($id);
|
||||
}
|
||||
|
||||
function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
function setUrl($url) {
|
||||
$this->url = $url;
|
||||
}
|
||||
|
||||
function setStatus($status) {
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
function setRtmp_server($rtmp_server) {
|
||||
$this->rtmp_server = $rtmp_server;
|
||||
}
|
||||
|
||||
function setPlayerServer($playerServer) {
|
||||
$this->playerServer = $playerServer;
|
||||
}
|
||||
|
||||
function setStats_url($stats_url) {
|
||||
$this->stats_url = $stats_url;
|
||||
}
|
||||
|
||||
function setDisableDVR($disableDVR) {
|
||||
$this->disableDVR = intval($disableDVR);
|
||||
}
|
||||
|
||||
function setDisableGifThumbs($disableGifThumbs) {
|
||||
$this->disableGifThumbs = intval($disableGifThumbs);
|
||||
}
|
||||
|
||||
function setUseAadaptiveMode($useAadaptiveMode) {
|
||||
$this->useAadaptiveMode = intval($useAadaptiveMode);
|
||||
}
|
||||
|
||||
function setProtectLive($protectLive) {
|
||||
$this->protectLive = intval($protectLive);
|
||||
}
|
||||
|
||||
function setGetRemoteFile($getRemoteFile) {
|
||||
$this->getRemoteFile = $getRemoteFile;
|
||||
}
|
||||
|
||||
function getId() {
|
||||
return intval($this->id);
|
||||
}
|
||||
|
||||
function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
function getUrl() {
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
function getStatus() {
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
function getRtmp_server() {
|
||||
return $this->rtmp_server;
|
||||
}
|
||||
|
||||
function getPlayerServer() {
|
||||
return $this->playerServer;
|
||||
}
|
||||
|
||||
function getStats_url() {
|
||||
return $this->stats_url;
|
||||
}
|
||||
|
||||
function getDisableDVR() {
|
||||
return intval($this->disableDVR);
|
||||
}
|
||||
|
||||
function getDisableGifThumbs() {
|
||||
return intval($this->disableGifThumbs);
|
||||
}
|
||||
|
||||
function getUseAadaptiveMode() {
|
||||
return intval($this->useAadaptiveMode);
|
||||
}
|
||||
|
||||
function getProtectLive() {
|
||||
return intval($this->protectLive);
|
||||
}
|
||||
|
||||
function getGetRemoteFile() {
|
||||
return $this->getRemoteFile;
|
||||
}
|
||||
|
||||
static function getStatsFromId($live_servers_id) {
|
||||
$ls = new Live_servers($live_servers_id);
|
||||
if (empty($ls->getStats_url())) {
|
||||
return false;
|
||||
}
|
||||
return Live::_getStats($live_servers_id);
|
||||
}
|
||||
|
||||
static function getAllActive() {
|
||||
global $global;
|
||||
if (!static::isTableInstalled()) {
|
||||
return false;
|
||||
}
|
||||
$sql = "SELECT * FROM " . static::getTableName() . " WHERE status='a' ";
|
||||
|
||||
$sql .= self::getSqlFromPost();
|
||||
$res = sqlDAL::readSql($sql);
|
||||
$fullData = sqlDAL::fetchAllAssoc($res);
|
||||
sqlDAL::close($res);
|
||||
$rows = array();
|
||||
if ($res != false) {
|
||||
foreach ($fullData as $row) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
} else {
|
||||
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
static function getServerFromRTMPHost($rtmpHostURI) {
|
||||
global $global;
|
||||
$host = trim($rtmpHostURI);
|
||||
$parts = parse_url($host);
|
||||
$host = "rtmp://{$parts["host"]}{$parts["path"]}";
|
||||
$host = $global['mysqli']->real_escape_string($host);
|
||||
$sql = "SELECT * FROM " . static::getTableName() . " WHERE rtmp_server LIKE '%{$host}%' ";
|
||||
$res = sqlDAL::readSql($sql);
|
||||
$data = sqlDAL::fetchAssoc($res);
|
||||
sqlDAL::close($res);
|
||||
if ($res) {
|
||||
$row = $data;
|
||||
} else {
|
||||
$row = false;
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
|
||||
static function getServerIdFromRTMPHost($rtmpHostURI) {
|
||||
$data = self::getServerFromRTMPHost($rtmpHostURI);
|
||||
if ($data) {
|
||||
$row = $data['id'];
|
||||
} else {
|
||||
$row = 0;
|
||||
}
|
||||
return intval($row);
|
||||
}
|
||||
|
||||
public function save() {
|
||||
$id = parent::save();
|
||||
if($id){
|
||||
_session_start();
|
||||
$_SESSION['useAadaptiveMode'] = array();
|
||||
$_SESSION['playerServer'] = array();
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
}
|
BIN
plugin/Live/Objects/modelLive.mwb
Normal file
BIN
plugin/Live/Objects/modelLive.mwb
Normal file
Binary file not shown.
BIN
plugin/Live/Objects/modelLive.mwb.bak
Normal file
BIN
plugin/Live/Objects/modelLive.mwb.bak
Normal file
Binary file not shown.
|
@ -34,7 +34,7 @@ _error_log("Live:getImage start");
|
|||
if($lt->userCanSeeTransmition()){
|
||||
$uuid = $livet['key'];
|
||||
$p = AVideoPlugin::loadPlugin("Live");
|
||||
$video = "{$p->getM3U8File($uuid)}";
|
||||
$video = Live::getM3U8File($uuid);
|
||||
$url = $config->getEncoderURL()."getImage/". base64_encode($video)."/{$_GET['format']}";
|
||||
_error_log("Live:getImage $url");
|
||||
|
||||
|
|
26
plugin/Live/getRecordedFile.php
Normal file
26
plugin/Live/getRecordedFile.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
die("Remove the line ".__LINE__." to use this script "); // remove this line so the script will work
|
||||
|
||||
$record_path = "/var/www/tmp/"; //update this URL
|
||||
|
||||
if (empty($_REQUEST['file'])) {
|
||||
die('file not found');
|
||||
}
|
||||
$file = preg_replace("/[^0-9a-z_:-]/i", "", $_REQUEST['file']);
|
||||
|
||||
$filename = $record_path . $file . ".flv";
|
||||
if(!file_exists($filename)){
|
||||
die('file does not exists');
|
||||
}
|
||||
$content = file_get_contents($filename);
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Disposition: attachment; filename=' . $file . ".flv");
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Connection: Keep-Alive');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Pragma: public');
|
||||
header('Content-Type: video/x-flv');
|
||||
header('Content-Length: ' . strlen($content));
|
||||
echo $content;
|
||||
unlink($filename);
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
require_once '../../videos/configuration.php';
|
||||
require_once $global['systemRootPath'] . 'objects/user.php';
|
||||
|
||||
$isLive = 1;
|
||||
$p = AVideoPlugin::loadPlugin("Live");
|
||||
|
||||
if (!empty($_GET['c'])) {
|
||||
|
@ -81,6 +81,31 @@ if (empty($channelName)) {
|
|||
include $global['systemRootPath'] . 'view/include/navbar.php';
|
||||
?>
|
||||
<div class="container">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<ul class="nav nav-tabs">
|
||||
<?php
|
||||
$servers = Live::getAllServers();
|
||||
$_REQUEST['live_servers_id'] = Live::getLiveServersIdRequest();
|
||||
foreach ($servers as $key => $value) {
|
||||
$active = "";
|
||||
if ($_REQUEST['live_servers_id']) {
|
||||
if ($_REQUEST['live_servers_id'] == $value['id']) {
|
||||
$active = "active";
|
||||
}
|
||||
} else if ($key == 0) {
|
||||
$_REQUEST['live_servers_id'] = $value['id'];
|
||||
$active = "active";
|
||||
}
|
||||
?>
|
||||
<li class="<?php echo $active; ?>"><a href="<?php echo $global['webSiteRootURL']; ?>plugin/Live/?live_servers_id=<?php echo $value['id']; ?>"><?php echo $value['name']; ?></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<div class="col-md-6" id="yptRightBar">
|
||||
<?php
|
||||
if (!empty($obj->experimentalWebcam)) {
|
||||
|
@ -112,7 +137,7 @@ if (empty($channelName)) {
|
|||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="playerURL"><i class="fa fa-play-circle"></i> <?php echo __("Player URL"); ?>:</label>
|
||||
<input type="text" class="form-control" id="playerURL" value="<?php echo $p->getM3U8File($trasnmition['key']); ?>" readonly="readonly">
|
||||
<input type="text" class="form-control" id="playerURL" value="<?php echo Live::getM3U8File($trasnmition['key']); ?>" readonly="readonly">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="avideoURL"><i class="fa fa-circle"></i> <?php echo __("Live URL"); ?>:</label>
|
||||
|
@ -129,7 +154,7 @@ if (empty($channelName)) {
|
|||
<div class="panel-body" style="overflow: hidden;">
|
||||
<div class="form-group">
|
||||
<label for="server"><i class="fa fa-server"></i> <?php echo __("Server URL"); ?>:</label>
|
||||
<input type="text" class="form-control" id="server" value="<?php echo $p->getServer(); ?>?p=<?php echo User::getUserPass(); ?>" readonly="readonly">
|
||||
<input type="text" class="form-control" id="server" value="<?php echo Live::getServer(); ?>?p=<?php echo User::getUserPass(); ?>" readonly="readonly">
|
||||
<small class="label label-info"><i class="fa fa-warning"></i> <?php echo __("If you change your password the Server URL parameters will be changed too."); ?></small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -143,7 +168,7 @@ if (empty($channelName)) {
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label for="streamkey"><i class="fa fa-key"></i> <?php echo __("Server URL"); ?> + <?php echo __("Stream name/key"); ?>:</label>
|
||||
<input type="text" class="form-control" id="serverAndStreamkey" value="<?php echo $p->getServer(); ?>?p=<?php echo User::getUserPass(); ?>/<?php echo $trasnmition['key']; ?>" readonly="readonly">
|
||||
<input type="text" class="form-control" id="serverAndStreamkey" value="<?php echo Live::getServer(); ?>?p=<?php echo User::getUserPass(); ?>/<?php echo $trasnmition['key']; ?>" readonly="readonly">
|
||||
<span class="label label-warning"><i class="fa fa-warning"></i> <?php echo __("Keep Key Private, Anyone with key can broadcast on your account"); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -164,8 +189,8 @@ if (empty($channelName)) {
|
|||
<div class="embed-responsive embed-responsive-16by9">
|
||||
<video poster="<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/OnAir.jpg" controls
|
||||
class="embed-responsive-item video-js vjs-default-skin <?php echo $vjsClass; ?> vjs-big-play-centered"
|
||||
id="mainVideo" data-setup='{ aspectRatio: "<?php echo $aspectRatio; ?>", "techorder" : ["flash", "html5"] }'>
|
||||
<source src="<?php echo $p->getM3U8File($trasnmition['key']); ?>" type='application/x-mpegURL'>
|
||||
id="mainVideo" >
|
||||
<source src="<?php echo Live::getM3U8File($trasnmition['key']); ?>" type='application/x-mpegURL'>
|
||||
</video>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -217,6 +242,9 @@ if (empty($channelName)) {
|
|||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$p->getChat($trasnmition['key']);
|
||||
|
@ -225,7 +253,7 @@ if (empty($channelName)) {
|
|||
include $global['systemRootPath'] . 'view/include/footer.php';
|
||||
?>
|
||||
<script>
|
||||
var flashvars = {server: "<?php echo $p->getServer(); ?>?p=<?php echo User::getUserPass(); ?>", stream: "<?php echo $trasnmition['key']; ?>"};
|
||||
var flashvars = {server: "<?php echo Live::getServer(); ?>?p=<?php echo User::getUserPass(); ?>", stream: "<?php echo $trasnmition['key']; ?>"};
|
||||
var params = {};
|
||||
var attributes = {};
|
||||
function amIOnline() {
|
||||
|
@ -282,6 +310,9 @@ if (empty($channelName)) {
|
|||
$('#enableWebCam').click(function () {
|
||||
amIOnline();
|
||||
});
|
||||
if (typeof player === 'undefined') {
|
||||
player = videojs('mainVideo'<?php echo PlayerSkins::getDataSetup(); ?>);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -72,8 +72,10 @@ CREATE TABLE IF NOT EXISTS `live_transmitions_history` (
|
|||
`created` DATETIME NULL,
|
||||
`modified` DATETIME NULL,
|
||||
`users_id` INT(11) NOT NULL,
|
||||
`live_servers_id` INT(11) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `fk_live_transmitions_history_users_idx` (`users_id` ASC),
|
||||
INDEX `fk_live_transmitions_history_live_servers1_idx` (`live_servers_id` ASC),
|
||||
CONSTRAINT `fk_live_transmitions_history_users`
|
||||
FOREIGN KEY (`users_id`)
|
||||
REFERENCES `users` (`id`)
|
||||
|
@ -97,6 +99,27 @@ CREATE TABLE IF NOT EXISTS `live_transmition_history_log` (
|
|||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `live_servers` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`url` VARCHAR(255) NULL,
|
||||
`status` CHAR(1) NULL DEFAULT 'a',
|
||||
`created` DATETIME NULL DEFAULT NULL,
|
||||
`modified` DATETIME NULL DEFAULT NULL,
|
||||
`rtmp_server` VARCHAR(255) NULL DEFAULT NULL,
|
||||
`playerServer` VARCHAR(255) NULL DEFAULT NULL,
|
||||
`stats_url` VARCHAR(255) NULL DEFAULT NULL,
|
||||
`disableDVR` TINYINT(1) NULL DEFAULT NULL,
|
||||
`disableGifThumbs` TINYINT(1) NULL DEFAULT NULL,
|
||||
`useAadaptiveMode` TINYINT(1) NULL DEFAULT NULL,
|
||||
`protectLive` TINYINT(1) NULL DEFAULT NULL,
|
||||
`getRemoteFile` VARCHAR(255) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `live_serversindex2` (`status` ASC),
|
||||
INDEX `live_servers` (`url` ASC))
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
|
||||
SET SQL_MODE=@OLD_SQL_MODE;
|
||||
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
||||
|
|
32
plugin/Live/install/updateV4.0.sql
Normal file
32
plugin/Live/install/updateV4.0.sql
Normal file
|
@ -0,0 +1,32 @@
|
|||
|
||||
CREATE TABLE IF NOT EXISTS `live_servers` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`url` VARCHAR(255) NULL,
|
||||
`status` CHAR(1) NULL DEFAULT 'a',
|
||||
`created` DATETIME NULL DEFAULT NULL,
|
||||
`modified` DATETIME NULL DEFAULT NULL,
|
||||
`rtmp_server` VARCHAR(255) NULL DEFAULT NULL,
|
||||
`playerServer` VARCHAR(255) NULL DEFAULT NULL,
|
||||
`stats_url` VARCHAR(255) NULL DEFAULT NULL,
|
||||
`disableDVR` TINYINT(1) NULL DEFAULT NULL,
|
||||
`disableGifThumbs` TINYINT(1) NULL DEFAULT NULL,
|
||||
`useAadaptiveMode` TINYINT(1) NULL DEFAULT NULL,
|
||||
`protectLive` TINYINT(1) NULL DEFAULT NULL,
|
||||
`getRemoteFile` VARCHAR(255) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `live_serversindex2` (`status` ASC),
|
||||
INDEX `live_servers` (`url` ASC))
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
ALTER TABLE `live_transmitions_history`
|
||||
ADD COLUMN `live_servers_id` INT(11) NULL DEFAULT NULL AFTER `users_id`,
|
||||
ADD INDEX `fk_live_transmitions_history_live_servers1_idx` (`live_servers_id` ASC);
|
||||
|
||||
ALTER TABLE `live_transmitions_history`
|
||||
ADD CONSTRAINT `fk_live_transmitions_history_live_servers1`
|
||||
FOREIGN KEY (`live_servers_id`)
|
||||
REFERENCES `live_servers` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION;
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
$recheckTolerance = 600; // 10 min
|
||||
require_once '../../videos/configuration.php';
|
||||
error_reporting(0);
|
||||
session_write_close();
|
||||
|
||||
if (empty($_GET['uuid'])) {
|
||||
|
@ -31,24 +31,55 @@ if (empty($_SESSION['m3u8Verified']) || $_SESSION['m3u8Verified'] + $recheckTole
|
|||
}
|
||||
unset($_SESSION['m3u8Verified']);
|
||||
}
|
||||
if (empty($_SESSION['playerServer'])) {
|
||||
|
||||
if(!isset($_SESSION['playerServer']) || !is_array($_SESSION['playerServer'])){
|
||||
_session_start();
|
||||
$_SESSION['playerServer'] = array();
|
||||
}
|
||||
if(!isset($_SESSION['useAadaptiveMode']) || !is_array($_SESSION['useAadaptiveMode'])){
|
||||
_session_start();
|
||||
$_SESSION['useAadaptiveMode'] = array();
|
||||
}
|
||||
|
||||
$live_servers_id = Live::getCurrentLiveServersId();
|
||||
|
||||
if (true || empty($_SESSION['playerServer'][$live_servers_id])) {
|
||||
_session_start();
|
||||
$obj = AVideoPlugin::getObjectData('Live');
|
||||
$_SESSION['playerServer'] = $obj->playerServer;
|
||||
$_SESSION['useAadaptiveMode'] = $obj->useAadaptiveMode;
|
||||
$_SESSION['playerServer'][$live_servers_id] = Live::getPlayerServer();
|
||||
$_SESSION['useAadaptiveMode'][$live_servers_id] = Live::getUseAadaptiveMode();
|
||||
} else {
|
||||
@$global['mysqli']->close();
|
||||
}
|
||||
if ($_SESSION['useAadaptiveMode']) {
|
||||
$complement = $_SESSION['playerServer'] . "/";
|
||||
$url = $_SESSION['playerServer'] . "/{$uuid}.m3u8";
|
||||
if ($_SESSION['useAadaptiveMode'][$live_servers_id]) {
|
||||
$complement = $_SESSION['playerServer'][$live_servers_id] . "/";
|
||||
$url = $_SESSION['playerServer'][$live_servers_id] . "/{$uuid}.m3u8";
|
||||
$content = url_get_contents($url);
|
||||
}
|
||||
|
||||
if (empty($content)) {
|
||||
$complement = $_SESSION['playerServer'] . "/{$uuid}/";
|
||||
$url = $_SESSION['playerServer'] . "/{$uuid}/index.m3u8";
|
||||
$complement = $_SESSION['playerServer'][$live_servers_id] . "/{$uuid}/";
|
||||
$url = $_SESSION['playerServer'][$live_servers_id] . "/{$uuid}/index.m3u8";
|
||||
$content = url_get_contents($url);
|
||||
if (!empty($content)) {
|
||||
_session_start();
|
||||
$_SESSION['useAadaptiveMode'][$live_servers_id] = 0;
|
||||
}
|
||||
}
|
||||
if (empty($_SESSION['useAadaptiveMode'][$live_servers_id]) && empty($content)) {
|
||||
$complement = $_SESSION['playerServer'][$live_servers_id] . "/";
|
||||
$url = $_SESSION['playerServer'][$live_servers_id] . "/{$uuid}.m3u8";
|
||||
$content = url_get_contents($url);
|
||||
if (!empty($content)) {
|
||||
_session_start();
|
||||
$_SESSION['useAadaptiveMode'][$live_servers_id] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($content)){ // get the default loop
|
||||
//$complement = "{$global['webSiteRootURL']}plugin/Live/view/loopBGHLS/";
|
||||
//$content = file_get_contents("{$global['systemRootPath']}plugin/Live/view/loopBGHLS/index.m3u8");
|
||||
include "{$global['systemRootPath']}plugin/Live/view/loopBGHLS/index.m3u8.php";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (empty($_SESSION['m3u8Verified'])) {
|
||||
|
@ -57,7 +88,7 @@ if (empty($_SESSION['m3u8Verified'])) {
|
|||
}
|
||||
$lines = preg_split("/((\r?\n)|(\r\n?))/", $content);
|
||||
for ($i = 0; $i < count($lines); $i++) {
|
||||
if (preg_match('/.*\.(m3u8|ts)$/i', $lines[$i])) {
|
||||
if (preg_match('/.*\.(m3u8|ts|key)$/i', $lines[$i])) {
|
||||
echo $complement;
|
||||
}
|
||||
echo $lines[$i] . PHP_EOL;
|
||||
|
|
|
@ -56,6 +56,7 @@ if (!empty($_GET['p'])) {
|
|||
$lth->setDescription($obj->row['description']);
|
||||
$lth->setKey($_POST['name']);
|
||||
$lth->setUsers_id($user->getBdId());
|
||||
$lth->setLive_servers_id(Live_servers::getServerIdFromRTMPHost($url));
|
||||
_error_log("NGINX ON Publish saving LiveTransmitionHistory");
|
||||
$lth->save();
|
||||
_error_log("NGINX ON Publish saved LiveTransmitionHistory");
|
||||
|
|
|
@ -1,98 +1,20 @@
|
|||
<?php
|
||||
|
||||
header('Content-Type: application/json');
|
||||
require_once '../../videos/configuration.php';
|
||||
session_write_close();
|
||||
require_once $global['systemRootPath'] . 'plugin/Live/Objects/LiveTransmition.php';
|
||||
require_once $global['systemRootPath'] . 'objects/user.php';
|
||||
$p = AVideoPlugin::loadPluginIfEnabled("Live");
|
||||
|
||||
ini_set('max_execution_time', 10);
|
||||
set_time_limit(10);
|
||||
$obj = new stdClass();
|
||||
$obj->error = true;
|
||||
$obj->msg = "OFFLINE";
|
||||
$obj->nclients = 0;
|
||||
if(empty($_POST['name']) && !empty($_GET['name'])){
|
||||
$_POST['name'] = $_GET['name'];
|
||||
}else if(empty($_POST['name'])){
|
||||
$_POST['name'] = "undefined";
|
||||
}
|
||||
$obj->name = $_POST['name'];
|
||||
$obj->applications = array();
|
||||
$_GET['lifetime'] = "10";
|
||||
if(empty($p)){
|
||||
die(json_encode($obj));
|
||||
}
|
||||
$xml = $p->getStatsObject();
|
||||
$xml = json_encode($xml);
|
||||
$xml = json_decode($xml);
|
||||
session_write_close();
|
||||
$pobj = AVideoPlugin::getDataObjectIfEnabled("Live");
|
||||
|
||||
$stream = false;
|
||||
$lifeStream = array();
|
||||
//$obj->server = $xml->server;
|
||||
if(!empty($xml->server->application) && !is_array($xml->server->application)){
|
||||
$application = $xml->server->application;
|
||||
$xml->server->application = array();
|
||||
$xml->server->application[] = $application;
|
||||
if (empty($pobj)) {
|
||||
die(json_encode("Plugin disabled"));
|
||||
}
|
||||
if(!empty($xml->server->application[0]->live->stream)){
|
||||
$lifeStream = $xml->server->application[0]->live->stream;
|
||||
if(!is_array($xml->server->application[0]->live->stream)){
|
||||
$lifeStream = array();
|
||||
$lifeStream[0] = $xml->server->application[0]->live->stream;
|
||||
$live_servers_id = Live::getCurrentLiveServersId();
|
||||
$cacheName = "statsCache_{$live_servers_id}_".md5($global['systemRootPath']);
|
||||
$json = ObjectYPT::getCache($cacheName, $pobj->cacheStatsTimout);
|
||||
if(empty($json)){
|
||||
$json = json_encode(Live::getStats());
|
||||
ObjectYPT::setCache($cacheName, $json);
|
||||
}
|
||||
}
|
||||
|
||||
require_once $global['systemRootPath'] . 'plugin/AVideoPlugin.php';
|
||||
// the live users plugin
|
||||
$liveUsersEnabled = AVideoPlugin::isEnabledByName("LiveUsers");
|
||||
|
||||
$obj->disableGif = $p->getDisableGifThumbs();
|
||||
$obj->countLiveStream = count($lifeStream);
|
||||
foreach ($lifeStream as $value){
|
||||
if(!empty($value->name)){
|
||||
$row = LiveTransmition::keyExists($value->name);
|
||||
if(!empty($row) && $value->name === $_POST['name']){
|
||||
$obj->msg = "ONLINE";
|
||||
}
|
||||
if(empty($row) || empty($row['public'])){
|
||||
continue;
|
||||
}
|
||||
|
||||
$users = false;
|
||||
if($liveUsersEnabled){
|
||||
$filename = $global['systemRootPath'] . 'plugin/LiveUsers/Objects/LiveOnlineUsers.php';
|
||||
if(file_exists($filename)){
|
||||
require_once $filename;
|
||||
$liveUsers = new LiveOnlineUsers(0);
|
||||
$users = $liveUsers->getUsersFromTransmitionKey($value->name);
|
||||
}
|
||||
}
|
||||
|
||||
$u = new User($row['users_id']);
|
||||
if($u->getStatus()!=='a'){
|
||||
continue;
|
||||
}
|
||||
|
||||
$userName = $u->getNameIdentificationBd();
|
||||
$user = $u->getUser();
|
||||
$channelName = $u->getChannelName();
|
||||
$photo = $u->getPhotoDB();
|
||||
$UserPhoto = $u->getPhoto();
|
||||
$obj->applications[] = array("key"=>$value->name, "users"=>$users, "name"=>$userName, "user"=>$user, "photo"=>$photo, "UserPhoto"=>$UserPhoto, "title"=>$row['title'], 'channelName'=>$channelName);
|
||||
if($value->name === $_POST['name']){
|
||||
$obj->error = property_exists($value, 'publishing')?false:true;
|
||||
$obj->msg = (!$obj->error)?"ONLINE":"Waiting for Streamer";
|
||||
$obj->stream = $value;
|
||||
$obj->nclients = intval($value->nclients);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$appArray = AVideoPlugin::getLiveApplicationArray();
|
||||
$obj->applications = array_merge($obj->applications, $appArray);
|
||||
|
||||
echo json_encode($obj);
|
||||
|
||||
include $global['systemRootPath'].'objects/include_end.php';
|
||||
echo $json;
|
34
plugin/Live/view/Live_servers/add.json.php
Normal file
34
plugin/Live/view/Live_servers/add.json.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require_once '../../../../videos/configuration.php';
|
||||
require_once $global['systemRootPath'] . 'plugin/Live/Objects/Live_servers.php';
|
||||
|
||||
$obj = new stdClass();
|
||||
$obj->error = true;
|
||||
$obj->msg = "";
|
||||
|
||||
$plugin = AVideoPlugin::loadPluginIfEnabled('Live');
|
||||
|
||||
if(!User::isAdmin()){
|
||||
$obj->msg = "You cant do this";
|
||||
die(json_encode($obj));
|
||||
}
|
||||
|
||||
$o = new Live_servers(@$_POST['id']);
|
||||
$o->setName($_POST['name']);
|
||||
$o->setUrl(@$_POST['url']);
|
||||
$o->setStatus($_POST['status']);
|
||||
$o->setRtmp_server($_POST['rtmp_server']);
|
||||
$o->setPlayerServer($_POST['playerServer']);
|
||||
$o->setStats_url($_POST['stats_url']);
|
||||
$o->setDisableDVR(@$_POST['disableDVR']);
|
||||
$o->setDisableGifThumbs(@$_POST['disableGifThumbs']);
|
||||
$o->setUseAadaptiveMode(@$_POST['useAadaptiveMode']);
|
||||
$o->setProtectLive(@$_POST['protectLive']);
|
||||
$o->setGetRemoteFile($_POST['getRemoteFile']);
|
||||
|
||||
if($id = $o->save()){
|
||||
$obj->error = false;
|
||||
}
|
||||
|
||||
echo json_encode($obj);
|
20
plugin/Live/view/Live_servers/delete.json.php
Normal file
20
plugin/Live/view/Live_servers/delete.json.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
require_once '../../../../videos/configuration.php';
|
||||
require_once $global['systemRootPath'] . 'plugin/Live/Objects/Live_servers.php';
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$obj = new stdClass();
|
||||
$obj->error = true;
|
||||
|
||||
$plugin = AVideoPlugin::loadPluginIfEnabled('Live');
|
||||
|
||||
if(!User::isAdmin()){
|
||||
$obj->msg = "You cant do this";
|
||||
die(json_encode($obj));
|
||||
}
|
||||
|
||||
$id = intval($_POST['id']);
|
||||
$row = new Live_servers($id);
|
||||
$obj->error = !$row->delete();
|
||||
die(json_encode($obj));
|
||||
?>
|
29
plugin/Live/view/Live_servers/index.php
Normal file
29
plugin/Live/view/Live_servers/index.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
global $global, $config;
|
||||
if (!isset($global['systemRootPath'])) {
|
||||
require_once '../../videos/configuration.php';
|
||||
}
|
||||
if (!User::isAdmin()) {
|
||||
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not do this"));
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?php echo $_SESSION['language']; ?>">
|
||||
<head>
|
||||
<title><?php echo $config->getWebSiteTitle(); ?> :: Live</title>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/head.php';
|
||||
include $global['systemRootPath'] . 'plugin/Live/View/{$classname}/index_head.php';
|
||||
?>
|
||||
</head>
|
||||
<body class="<?php echo $global['bodyClass']; ?>">
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/navbar.php';
|
||||
include $global['systemRootPath'] . 'plugin/Live/View/{$classname}/index_body.php';
|
||||
include $global['systemRootPath'] . 'view/include/footer.php';
|
||||
?>
|
||||
<script type="text/javascript" src="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.js"></script>
|
||||
</body>
|
||||
</html>
|
281
plugin/Live/view/Live_servers/index_body.php
Normal file
281
plugin/Live/view/Live_servers/index_body.php
Normal file
|
@ -0,0 +1,281 @@
|
|||
<?php
|
||||
global $global, $config;
|
||||
if (!isset($global['systemRootPath'])) {
|
||||
require_once '../../videos/configuration.php';
|
||||
}
|
||||
if (!User::isAdmin()) {
|
||||
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not do this"));
|
||||
exit;
|
||||
}
|
||||
$obj = AVideoPlugin::getObjectData("Live");
|
||||
?>
|
||||
<style>
|
||||
#panelLive_serversForm div{
|
||||
min-height: 50px;
|
||||
}
|
||||
</style>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="fas fa-cog"></i> <?php echo __("Configurations"); ?>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<?php
|
||||
if(empty($obj->useLiveServers)){
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
Live Servers is Disabled, if you want to use it, enable it on the (Live) Plugin
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="panel panel-default ">
|
||||
<div class="panel-heading"><i class="far fa-plus-square"></i> <?php echo __("Create"); ?></div>
|
||||
<div class="panel-body">
|
||||
<form id="panelLive_serversForm">
|
||||
<div class="row">
|
||||
<input type="hidden" name="id" id="Live_serversid" value="" >
|
||||
<div class="form-group col-sm-12">
|
||||
<label for="Live_serversname"><?php echo __("Name"); ?>:</label>
|
||||
<input type="text" id="Live_serversname" name="name" class="form-control input-sm" placeholder="<?php echo __("Name"); ?>" required="true">
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="Live_serversrtmp_server"><?php echo __("Rtmp Server"); ?>:</label>
|
||||
<input type="url" id="Live_serversrtmp_server" name="rtmp_server" class="form-control input-sm" placeholder="<?php echo __("Rtmp Server"); ?>" required="true">
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="Live_serversplayerServer"><?php echo __("Player Server"); ?>:</label>
|
||||
<input type="url" id="Live_serversplayerServer" name="playerServer" class="form-control input-sm" placeholder="<?php echo __("PlayerServer"); ?>" required="true">
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="Live_serversstats_url"><?php echo __("Stats Url"); ?>:</label>
|
||||
<input type="url" id="Live_serversstats_url" name="stats_url" class="form-control input-sm" placeholder="<?php echo __("Stats Url"); ?>" required="true">
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="Live_serversgetRemoteFile"><?php echo __("Get Remote File URL"); ?>:</label>
|
||||
<input type="url" id="Live_serversgetRemoteFile" name="getRemoteFile" class="form-control input-sm" placeholder="<?php echo __("GetRemoteFile"); ?>" required="true">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-4">
|
||||
<label for="status"><?php echo __("Status"); ?>:</label>
|
||||
<select class="form-control input-sm" name="status" id="Live_serversstatus">
|
||||
<option value="a"><?php echo __("Active"); ?></option>
|
||||
<option value="i"><?php echo __("Inactive"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-sm-4">
|
||||
<label for="Live_serversdisableDVR"><?php echo __("DisableDVR"); ?>:</label>
|
||||
<select class="form-control input-sm" id="Live_serversdisableDVR" name="disableDVR" >
|
||||
<option value="0"><?php echo __("No"); ?></option>
|
||||
<option value="1"><?php echo __("Yes"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-sm-4">
|
||||
<label for="Live_serversdisableGifThumbs"><?php echo __("DisableGifThumbs"); ?>:</label>
|
||||
<select class="form-control input-sm" id="Live_serversdisableGifThumbs" name="disableGifThumbs" >
|
||||
<option value="0"><?php echo __("No"); ?></option>
|
||||
<option value="1"><?php echo __("Yes"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-sm-4">
|
||||
<label for="Live_serversuseAadaptiveMode"><?php echo __("UseAadaptiveMode"); ?>:</label>
|
||||
<select class="form-control input-sm" id="Live_serversuseAadaptiveMode" name="useAadaptiveMode" >
|
||||
<option value="0"><?php echo __("No"); ?></option>
|
||||
<option value="1"><?php echo __("Yes"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-sm-4">
|
||||
<label for="Live_serversprotectLive"><?php echo __("ProtectLive"); ?>:</label>
|
||||
<select class="form-control input-sm" id="Live_serversprotectLive" name="protectLive">
|
||||
<option value="0"><?php echo __("No"); ?></option>
|
||||
<option value="1"><?php echo __("Yes"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-sm-12">
|
||||
<div class="btn-group pull-right">
|
||||
<span class="btn btn-success" id="newLive_servers"><i class="fas fa-plus"></i> <?php echo __("New"); ?></span>
|
||||
<button class="btn btn-primary" type="submit"><i class="fas fa-save"></i> <?php echo __("Save"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="panel panel-default ">
|
||||
<div class="panel-heading"><i class="fas fa-edit"></i> <?php echo __("Edit"); ?></div>
|
||||
<div class="panel-body">
|
||||
<table id="Live_serversTable" class="display table table-bordered table-responsive table-striped table-hover table-condensed" width="100%" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th><?php echo __("Name"); ?></th>
|
||||
<th><?php echo __("RTMP"); ?></th>
|
||||
<th><?php echo __("Status"); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th><?php echo __("Name"); ?></th>
|
||||
<th><?php echo __("RTMP"); ?></th>
|
||||
<th><?php echo __("Status"); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<div class="alert alert-info">
|
||||
Make sure your nginx.conf has the following parameters
|
||||
<hr>
|
||||
<code>
|
||||
|
||||
on_publish <?php echo $global['webSiteRootURL']; ?>plugin/Live/on_publish.php;<br>
|
||||
on_play <?php echo $global['webSiteRootURL']; ?>plugin/Live/on_play.php;<br>
|
||||
on_record_done <?php echo $global['webSiteRootURL']; ?>plugin/Live/on_record_done.php;<br>
|
||||
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="Live_serversbtnModelLinks" style="display: none;">
|
||||
<div class="btn-group pull-right">
|
||||
<button href="" class="edit_Live_servers btn btn-default btn-xs">
|
||||
<i class="fa fa-edit"></i>
|
||||
</button>
|
||||
<button href="" class="delete_Live_servers btn btn-danger btn-xs">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function clearLive_serversForm() {
|
||||
$('#Live_serversid').val('');
|
||||
$('#Live_serversname').val('');
|
||||
$('#Live_serversurl').val('');
|
||||
$('#Live_serversstatus').val('');
|
||||
$('#Live_serversrtmp_server').val('');
|
||||
$('#Live_serversplayerServer').val('');
|
||||
$('#Live_serversstats_url').val('');
|
||||
$('#Live_serversdisableDVR').val('');
|
||||
$('#Live_serversdisableGifThumbs').val('');
|
||||
$('#Live_serversuseAadaptiveMode').val('');
|
||||
$('#Live_serversprotectLive').val('');
|
||||
$('#Live_serversgetRemoteFile').val('');
|
||||
}
|
||||
$(document).ready(function () {
|
||||
$('#addLiveBtn').click(function () {
|
||||
$.ajax({
|
||||
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/addLive_serversVideo.php',
|
||||
data: $('#panelLive_serversForm').serialize(),
|
||||
type: 'post',
|
||||
success: function (response) {
|
||||
if (response.error) {
|
||||
swal("<?php echo __("Sorry!"); ?>", response.msg, "error");
|
||||
} else {
|
||||
swal("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your register has been saved!"); ?>", "success");
|
||||
$("#panelLive_serversForm").trigger("reset");
|
||||
}
|
||||
clearLive_serversForm();
|
||||
tableVideos.ajax.reload();
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
});
|
||||
});
|
||||
var Live_serverstableVar = $('#Live_serversTable').DataTable({
|
||||
"ajax": "<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/Live_servers/list.json.php",
|
||||
"columns": [
|
||||
{"data": "id"},
|
||||
{"data": "name"},
|
||||
{"data": "rtmp_server"},
|
||||
{"data": "status"},
|
||||
{
|
||||
sortable: false,
|
||||
data: null,
|
||||
defaultContent: $('#Live_serversbtnModelLinks').html()
|
||||
}
|
||||
],
|
||||
select: true,
|
||||
});
|
||||
$('#newLive_servers').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
$('#panelLive_serversForm').trigger("reset");
|
||||
$('#Live_serversid').val('');
|
||||
});
|
||||
$('#panelLive_serversForm').on('submit', function (e) {
|
||||
e.preventDefault();
|
||||
modal.showPleaseWait();
|
||||
$.ajax({
|
||||
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/Live_servers/add.json.php',
|
||||
data: $('#panelLive_serversForm').serialize(),
|
||||
type: 'post',
|
||||
success: function (response) {
|
||||
if (response.error) {
|
||||
swal("<?php echo __("Sorry!"); ?>", response.msg, "error");
|
||||
} else {
|
||||
swal("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your register has been saved!"); ?>", "success");
|
||||
$("#panelLive_serversForm").trigger("reset");
|
||||
}
|
||||
Live_serverstableVar.ajax.reload();
|
||||
$('#Live_serversid').val('');
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#Live_serversTable').on('click', 'button.delete_Live_servers', function (e) {
|
||||
e.preventDefault();
|
||||
var tr = $(this).closest('tr')[0];
|
||||
var data = Live_serverstableVar.row(tr).data();
|
||||
swal({
|
||||
title: "<?php echo __("Are you sure?"); ?>",
|
||||
text: "<?php echo __("You will not be able to recover this action!"); ?>",
|
||||
icon: "warning",
|
||||
buttons: true,
|
||||
dangerMode: true,
|
||||
})
|
||||
.then((willDelete) => {
|
||||
if (willDelete) {
|
||||
modal.showPleaseWait();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/Live_servers/delete.json.php",
|
||||
data: data
|
||||
|
||||
}).done(function (resposta) {
|
||||
if (resposta.error) {
|
||||
swal("<?php echo __("Sorry!"); ?>", resposta.msg, "error");
|
||||
}
|
||||
Live_serverstableVar.ajax.reload();
|
||||
modal.hidePleaseWait();
|
||||
});
|
||||
} else {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#Live_serversTable').on('click', 'button.edit_Live_servers', function (e) {
|
||||
e.preventDefault();
|
||||
var tr = $(this).closest('tr')[0];
|
||||
var data = Live_serverstableVar.row(tr).data();
|
||||
$('#Live_serversid').val(data.id);
|
||||
$('#Live_serversname').val(data.name);
|
||||
$('#Live_serversurl').val(data.url);
|
||||
$('#Live_serversstatus').val(data.status);
|
||||
$('#Live_serversrtmp_server').val(data.rtmp_server);
|
||||
$('#Live_serversplayerServer').val(data.playerServer);
|
||||
$('#Live_serversstats_url').val(data.stats_url);
|
||||
$('#Live_serversdisableDVR').val(data.disableDVR);
|
||||
$('#Live_serversdisableGifThumbs').val(data.disableGifThumbs);
|
||||
$('#Live_serversuseAadaptiveMode').val(data.useAadaptiveMode);
|
||||
$('#Live_serversprotectLive').val(data.protectLive);
|
||||
$('#Live_serversgetRemoteFile').val(data.getRemoteFile);
|
||||
});
|
||||
});
|
||||
</script>
|
5
plugin/Live/view/Live_servers/index_head.php
Normal file
5
plugin/Live/view/Live_servers/index_head.php
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
$plugin = AVideoPlugin::loadPluginIfEnabled('Live');
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.css"/>
|
||||
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css"/>
|
8
plugin/Live/view/Live_servers/list.json.php
Normal file
8
plugin/Live/view/Live_servers/list.json.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
require_once '../../../../videos/configuration.php';
|
||||
require_once $global['systemRootPath'] . 'plugin/Live/Objects/Live_servers.php';
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$rows = Live_servers::getAll();
|
||||
?>
|
||||
{"data": <?php echo json_encode($rows); ?>}
|
50
plugin/Live/view/editor.php
Normal file
50
plugin/Live/view/editor.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
require_once '../../../videos/configuration.php';
|
||||
AVideoPlugin::loadPlugin("Live");
|
||||
if (!PayPerview::canCreatePPV()) {
|
||||
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not manage this plugin"));
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?php echo $_SESSION['language']; ?>">
|
||||
<head>
|
||||
<title><?php echo $config->getWebSiteTitle(); ?> :: Live</title>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/head.php';
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.css"/>
|
||||
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body class="<?php echo $global['bodyClass']; ?>">
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/navbar.php';
|
||||
?>
|
||||
<div class="container-fluid">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><?php echo __('Live') ?>
|
||||
<div class="pull-right">
|
||||
<?php echo AVideoPlugin::getSwitchButton("Live"); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a data-toggle="tab" href="#Live_servers"><?php echo __("Live Servers"); ?></a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div id="Live_servers" class="tab-pane fade in active" style="padding: 10px;">
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'plugin/Live/view/Live_servers/index_body.php';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.js"></script>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/footer.php';
|
||||
?>
|
||||
</body>
|
||||
</html>
|
|
@ -15,7 +15,7 @@
|
|||
<video poster="<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/OnAir.jpg" controls playsinline webkit-playsinline="webkit-playsinline"
|
||||
class="embed-responsive-item video-js vjs-default-skin vjs-big-play-centered liveVideo vjs-16-9"
|
||||
id="mainVideo">
|
||||
<source src="<?php echo $p->getM3U8File($uuid); ?>" type='application/x-mpegURL'>
|
||||
<source src="<?php echo Live::getM3U8File($uuid); ?>" type='application/x-mpegURL'>
|
||||
</video>
|
||||
<?php
|
||||
if (AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) {
|
||||
|
|
1
plugin/Live/view/loopBGHLS/enc_5efe4da35485d.key
Normal file
1
plugin/Live/view/loopBGHLS/enc_5efe4da35485d.key
Normal file
|
@ -0,0 +1 @@
|
|||
<EFBFBD>%M/> <09><><EFBFBD><EFBFBD><EFBFBD>a<EFBFBD>
|
10
plugin/Live/view/loopBGHLS/index.m3u8
Normal file
10
plugin/Live/view/loopBGHLS/index.m3u8
Normal file
|
@ -0,0 +1,10 @@
|
|||
#EXTM3U
|
||||
#EXT-X-VERSION:3
|
||||
#EXT-X-STREAM-INF:BANDWIDTH=300000
|
||||
res240/index.m3u8
|
||||
#EXT-X-STREAM-INF:BANDWIDTH=600000
|
||||
res360/index.m3u8
|
||||
#EXT-X-STREAM-INF:BANDWIDTH=1000000
|
||||
res480/index.m3u8
|
||||
#EXT-X-STREAM-INF:BANDWIDTH=2000000
|
||||
res720/index.m3u8
|
35
plugin/Live/view/loopBGHLS/index.m3u8.php
Normal file
35
plugin/Live/view/loopBGHLS/index.m3u8.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
header("Content-Type: audio/x-mpegurl");
|
||||
session_start();
|
||||
$dirURL = "";
|
||||
if(!empty($global['webSiteRootURL'])){
|
||||
$dirURL = "{$global['webSiteRootURL']}plugin/Live/view/loopBGHLS/";
|
||||
}
|
||||
if(empty($_GET['res'])){
|
||||
?>#EXTM3U
|
||||
#EXT-X-VERSION:3
|
||||
#EXT-X-STREAM-INF:BANDWIDTH=300000
|
||||
<?php echo $dirURL; ?>res240/index.m3u8.php?res=240
|
||||
#EXT-X-STREAM-INF:BANDWIDTH=600000
|
||||
<?php echo $dirURL; ?>res360/index.m3u8.php?res=360
|
||||
#EXT-X-STREAM-INF:BANDWIDTH=1000000
|
||||
<?php echo $dirURL; ?>res480/index.m3u8.php?res=480
|
||||
#EXT-X-STREAM-INF:BANDWIDTH=2000000
|
||||
<?php echo $dirURL; ?>res720/index.m3u8.php?res=720
|
||||
<?php
|
||||
$_SESSION['EXT-X-DISCONTINUITY-SEQUENCE'] = 0;
|
||||
exit;
|
||||
}
|
||||
|
||||
?>#EXTM3U
|
||||
#EXT-X-VERSION:3
|
||||
#EXT-X-MEDIA-SEQUENCE:<?php echo ++$_SESSION['EXT-X-DISCONTINUITY-SEQUENCE'], PHP_EOL; ?>
|
||||
#EXT-X-DISCONTINUITY-SEQUENCE:<?php echo $_SESSION['EXT-X-DISCONTINUITY-SEQUENCE'], PHP_EOL; ?>
|
||||
#EXT-X-DISCONTINUITY
|
||||
#EXT-X-TARGETDURATION:8
|
||||
#EXT-X-KEY:METHOD=AES-128,URI="../enc_5efe4da35485d.key"
|
||||
#EXTINF:8.341667,
|
||||
index0.ts?seq=<?php echo $_SESSION['EXT-X-DISCONTINUITY-SEQUENCE'],PHP_EOL; ?>
|
||||
#EXTINF:1.668333,
|
||||
index1.ts?seq=<?php echo $_SESSION['EXT-X-DISCONTINUITY-SEQUENCE'],PHP_EOL; ?>
|
||||
|
14
plugin/Live/view/loopBGHLS/index.ts.php
Normal file
14
plugin/Live/view/loopBGHLS/index.ts.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
header("Content-Type: video/mp2t");
|
||||
|
||||
if(empty($_GET['res'])){
|
||||
$_GET['res'] = 240;
|
||||
}
|
||||
$_GET['res'] = intval($_GET['res']);
|
||||
if($_GET['seq']%2){
|
||||
$filename = "res{$_GET['res']}/index1.ts";
|
||||
}else{
|
||||
$filename = "res{$_GET['res']}/index0.ts";
|
||||
}
|
||||
echo file_get_contents($filename);
|
||||
?>
|
10
plugin/Live/view/loopBGHLS/res240/index.m3u8
Normal file
10
plugin/Live/view/loopBGHLS/res240/index.m3u8
Normal file
|
@ -0,0 +1,10 @@
|
|||
#EXTM3U
|
||||
#EXT-X-VERSION:3
|
||||
#EXT-X-TARGETDURATION:6
|
||||
#EXT-X-MEDIA-SEQUENCE:0
|
||||
#EXT-X-KEY:METHOD=AES-128,URI="../enc_5efe4da35485d.key"
|
||||
#EXTINF:6.000000,
|
||||
index0.ts
|
||||
#EXTINF:4.083333,
|
||||
index1.ts
|
||||
#EXT-X-ENDLIST
|
4
plugin/Live/view/loopBGHLS/res240/index.m3u8.php
Normal file
4
plugin/Live/view/loopBGHLS/res240/index.m3u8.php
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
include '../index.m3u8.php';
|
||||
?>
|
||||
|
BIN
plugin/Live/view/loopBGHLS/res240/index0.ts
Normal file
BIN
plugin/Live/view/loopBGHLS/res240/index0.ts
Normal file
Binary file not shown.
BIN
plugin/Live/view/loopBGHLS/res240/index1.ts
Normal file
BIN
plugin/Live/view/loopBGHLS/res240/index1.ts
Normal file
Binary file not shown.
10
plugin/Live/view/loopBGHLS/res360/index.m3u8
Normal file
10
plugin/Live/view/loopBGHLS/res360/index.m3u8
Normal file
|
@ -0,0 +1,10 @@
|
|||
#EXTM3U
|
||||
#EXT-X-VERSION:3
|
||||
#EXT-X-TARGETDURATION:8
|
||||
#EXT-X-MEDIA-SEQUENCE:0
|
||||
#EXT-X-KEY:METHOD=AES-128,URI="../enc_5efe4da35485d.key"
|
||||
#EXTINF:8.341667,
|
||||
index0.ts
|
||||
#EXTINF:1.668333,
|
||||
index1.ts
|
||||
#EXT-X-ENDLIST
|
4
plugin/Live/view/loopBGHLS/res360/index.m3u8.php
Normal file
4
plugin/Live/view/loopBGHLS/res360/index.m3u8.php
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
include '../index.m3u8.php';
|
||||
?>
|
||||
|
BIN
plugin/Live/view/loopBGHLS/res360/index0.ts
Normal file
BIN
plugin/Live/view/loopBGHLS/res360/index0.ts
Normal file
Binary file not shown.
BIN
plugin/Live/view/loopBGHLS/res360/index1.ts
Normal file
BIN
plugin/Live/view/loopBGHLS/res360/index1.ts
Normal file
Binary file not shown.
10
plugin/Live/view/loopBGHLS/res480/index.m3u8
Normal file
10
plugin/Live/view/loopBGHLS/res480/index.m3u8
Normal file
|
@ -0,0 +1,10 @@
|
|||
#EXTM3U
|
||||
#EXT-X-VERSION:3
|
||||
#EXT-X-TARGETDURATION:8
|
||||
#EXT-X-MEDIA-SEQUENCE:0
|
||||
#EXT-X-KEY:METHOD=AES-128,URI="../enc_5efe4da35485d.key"
|
||||
#EXTINF:8.341667,
|
||||
index0.ts
|
||||
#EXTINF:1.668333,
|
||||
index1.ts
|
||||
#EXT-X-ENDLIST
|
4
plugin/Live/view/loopBGHLS/res480/index.m3u8.php
Normal file
4
plugin/Live/view/loopBGHLS/res480/index.m3u8.php
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
include '../index.m3u8.php';
|
||||
?>
|
||||
|
BIN
plugin/Live/view/loopBGHLS/res480/index0.ts
Normal file
BIN
plugin/Live/view/loopBGHLS/res480/index0.ts
Normal file
Binary file not shown.
BIN
plugin/Live/view/loopBGHLS/res480/index1.ts
Normal file
BIN
plugin/Live/view/loopBGHLS/res480/index1.ts
Normal file
Binary file not shown.
10
plugin/Live/view/loopBGHLS/res720/index.m3u8
Normal file
10
plugin/Live/view/loopBGHLS/res720/index.m3u8
Normal file
|
@ -0,0 +1,10 @@
|
|||
#EXTM3U
|
||||
#EXT-X-VERSION:3
|
||||
#EXT-X-TARGETDURATION:8
|
||||
#EXT-X-MEDIA-SEQUENCE:0
|
||||
#EXT-X-KEY:METHOD=AES-128,URI="../enc_5efe4da35485d.key"
|
||||
#EXTINF:8.341667,
|
||||
index0.ts
|
||||
#EXTINF:1.668333,
|
||||
index1.ts
|
||||
#EXT-X-ENDLIST
|
4
plugin/Live/view/loopBGHLS/res720/index.m3u8.php
Normal file
4
plugin/Live/view/loopBGHLS/res720/index.m3u8.php
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
include '../index.m3u8.php';
|
||||
?>
|
||||
|
BIN
plugin/Live/view/loopBGHLS/res720/index0.ts
Normal file
BIN
plugin/Live/view/loopBGHLS/res720/index0.ts
Normal file
Binary file not shown.
BIN
plugin/Live/view/loopBGHLS/res720/index1.ts
Normal file
BIN
plugin/Live/view/loopBGHLS/res720/index1.ts
Normal file
Binary file not shown.
|
@ -12,6 +12,8 @@
|
|||
#availableLiveStream{
|
||||
max-width: 400px;
|
||||
overflow: hidden;
|
||||
max-height: 75vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
#availableLiveStream li a div{
|
||||
overflow: hidden;
|
||||
|
@ -111,8 +113,8 @@ if (empty($obj->doNotShowGoLiveButton) && User::canStream()) {
|
|||
$('.liveUsersViews_' + key).text(views);
|
||||
}
|
||||
|
||||
function createExtraVideos(href, title, name, photo, user, online, views, key, disableGif) {
|
||||
var id = 'extraVideo' + user;
|
||||
function createExtraVideos(href, title, name, photo, user, online, views, key, disableGif, live_servers_id) {
|
||||
var id = 'extraVideo' + user + "_" + live_servers_id;
|
||||
id = id.replace(/\W/g, '');
|
||||
if ($(".extraVideos").length && $("#" + id).length == 0) {
|
||||
var $liveLi = $('.extraVideosModel').clone();
|
||||
|
@ -127,9 +129,9 @@ if (empty($obj->doNotShowGoLiveButton) && User::canStream()) {
|
|||
$liveLi.find('.liveUsersViews').text(views);
|
||||
$liveLi.find('.liveUsersOnline').addClass("liveUsersOnline_" + key);
|
||||
$liveLi.find('.liveUsersViews').addClass("liveUsersViews_" + key);
|
||||
$liveLi.find('.thumbsJPG').attr("src", "<?php echo $global['webSiteRootURL']; ?>plugin/Live/getImage.php?u=" + user + "&format=jpg");
|
||||
$liveLi.find('.thumbsJPG').attr("src", "<?php echo $global['webSiteRootURL']; ?>plugin/Live/getImage.php?live_servers_id=" + live_servers_id + "&u=" + user + "&format=jpg");
|
||||
if (!disableGif) {
|
||||
$liveLi.find('.thumbsGIF').attr("src", "<?php echo $global['webSiteRootURL']; ?>plugin/Live/getImage.php?u=" + user + "&format=gif");
|
||||
$liveLi.find('.thumbsGIF').attr("src", "<?php echo $global['webSiteRootURL']; ?>plugin/Live/getImage.php?live_servers_id=" + live_servers_id + "&u=" + user + "&format=gif");
|
||||
} else {
|
||||
$liveLi.find('.thumbsGIF').remove();
|
||||
}
|
||||
|
@ -140,12 +142,43 @@ if (empty($obj->doNotShowGoLiveButton) && User::canStream()) {
|
|||
}
|
||||
|
||||
function getStatsMenu(recurrentCall) {
|
||||
availableLiveStreamIsLoading();
|
||||
$.ajax({
|
||||
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Live/stats.json.php?Menu<?php echo (!empty($_GET['videoName']) ? "&requestComesFromVideoPage=1" : "") ?>',
|
||||
url: webSiteRootURL + 'plugin/Live/stats.json.php?Menu<?php echo (!empty($_GET['videoName']) ? "&requestComesFromVideoPage=1" : "") ?>',
|
||||
success: function (response) {
|
||||
if (typeof response.applications !== 'undefined') {
|
||||
$('.onlineApplications').text(response.applications.length);
|
||||
if (typeof response !== 'undefined') {
|
||||
var total = 0;
|
||||
$('#availableLiveStream').empty();
|
||||
if (isArray(response)) {
|
||||
for (var i in response) {
|
||||
if (typeof response[i] !== 'object') {
|
||||
continue;
|
||||
}
|
||||
total += response[i].applications.length;
|
||||
processApplicationLive(response[i]);
|
||||
}
|
||||
} else {
|
||||
total = response.applications.length;
|
||||
processApplicationLive(response);
|
||||
}
|
||||
if (!total) {
|
||||
availableLiveStreamNotFound();
|
||||
} else {
|
||||
$('#availableLiveStream').removeClass('notfound');
|
||||
}
|
||||
$('.onlineApplications').text(total);
|
||||
}
|
||||
if (recurrentCall) {
|
||||
setTimeout(function () {
|
||||
getStatsMenu(true);
|
||||
}, <?php echo $obj->requestStatsInterval * 1000; ?>);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function processApplicationLive(response) {
|
||||
if (typeof response.applications !== 'undefined') {
|
||||
if (response.applications.length) {
|
||||
disableGif = response.disableGif;
|
||||
for (i = 0; i < response.applications.length; i++) {
|
||||
|
@ -160,7 +193,7 @@ if (empty($obj->doNotShowGoLiveButton) && User::canStream()) {
|
|||
}
|
||||
$('#liveVideos').slideDown();
|
||||
} else {
|
||||
href = "<?php echo $global['webSiteRootURL']; ?>plugin/Live/?c=" + response.applications[i].channelName;
|
||||
href = "<?php echo $global['webSiteRootURL']; ?>plugin/Live/?live_servers_id=" + response.live_servers_id + "&c=" + response.applications[i].channelName;
|
||||
title = response.applications[i].title;
|
||||
name = response.applications[i].name;
|
||||
user = response.applications[i].user;
|
||||
|
@ -168,31 +201,40 @@ if (empty($obj->doNotShowGoLiveButton) && User::canStream()) {
|
|||
online = response.applications[i].users.online;
|
||||
views = response.applications[i].users.views;
|
||||
key = response.applications[i].key;
|
||||
live_servers_id = response.live_servers_id;
|
||||
createLiveItem(href, title, name, photo, false, online, views, key);
|
||||
<?php
|
||||
if (empty($obj->doNotShowLiveOnVideosList)) {
|
||||
?>
|
||||
createExtraVideos(href, title, name, photo, user, online, views, key, disableGif);
|
||||
createExtraVideos(href, title, name, photo, user, online, views, key, disableGif, live_servers_id);
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
}
|
||||
}
|
||||
mouseEffect();
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function availableLiveStreamIsLoading() {
|
||||
if ($('#availableLiveStream').hasClass('notfound')) {
|
||||
$('#availableLiveStream').empty();
|
||||
createLiveItem("#", "<?php echo __("Please Wait, we are checking the lives"); ?>", "", "", true);
|
||||
$('#availableLiveStream').find('.fa-ban').removeClass("fa-ban").addClass("fa-sync fa-spin");
|
||||
$('#availableLiveStream').find('.liveLink div').attr('style', '');
|
||||
}
|
||||
}
|
||||
|
||||
function availableLiveStreamNotFound() {
|
||||
$('#availableLiveStream').addClass('notfound');
|
||||
$('#availableLiveStream').empty();
|
||||
createLiveItem("#", "<?php echo __("There is no streaming now"); ?>", "", "", true);
|
||||
}
|
||||
}
|
||||
if (recurrentCall) {
|
||||
setTimeout(function () {
|
||||
getStatsMenu(true);
|
||||
}, 10000);
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#availableLiveStream').find('.liveLink div').attr('style', '');
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
availableLiveStreamIsLoading();
|
||||
getStatsMenu(true);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -1,39 +1,107 @@
|
|||
|
||||
<span class="label label-danger" id="liveViewStatus">OFFLINE</span>
|
||||
<!--
|
||||
<span class="label label-default" id="liveViewViews"><i class="fa fa-eye"></i> <span class="liveViewCount" style="font-size: 0.9em;">0</span></span>
|
||||
-->
|
||||
<?php
|
||||
$live_servers_id = Live::getCurrentLiveServersId();
|
||||
?>
|
||||
<span class="label label-danger" id="liveViewStatus<?php echo $live_servers_id; ?>">OFFLINE</span>
|
||||
<script>
|
||||
function getStats() {
|
||||
|
||||
function isOfflineVideo() {
|
||||
if (player.readyState()) {
|
||||
var uri = player.tech_.hls.selectPlaylist().uri;
|
||||
if (uri.includes("loopBGHLS/res")) {
|
||||
return true;
|
||||
}
|
||||
if (player.tech_.hls.playlists.media_.segments[0].resolvedUri.includes(".ts?seq=")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
var playCorrectSource<?php echo $live_servers_id; ?>Timout;
|
||||
function playCorrectSource<?php echo $live_servers_id; ?>() {
|
||||
if($('#liveViewStatus<?php echo $live_servers_id; ?>').hasClass('isOnline') && !isOfflineVideo()){
|
||||
console.log("Change video to Online");
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').removeClass('label-warning');
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').removeClass('label-danger');
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').addClass('label-success');
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').text("<?php echo __("ONLINE"); ?>");
|
||||
player.play();
|
||||
}else if ($('#liveViewStatus<?php echo $live_servers_id; ?>').hasClass('isOnline') && isOfflineVideo()) {
|
||||
console.log("Change video to please wait");
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').removeClass('label-success');
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').removeClass('label-danger');
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').addClass('label-warning');
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').text("<?php echo __("Please Wait ..."); ?>");
|
||||
reloadVideoJS();
|
||||
playerPlay(0);
|
||||
player.on('error', function(){
|
||||
console.log("PError 1 "+player.error());
|
||||
});
|
||||
player.tech_.hls.playlists.on('error', function(){
|
||||
console.log("PError 2 "+player.error());
|
||||
console.log("PError 2.1 "+this.error());
|
||||
});
|
||||
clearTimeout(playCorrectSource<?php echo $live_servers_id; ?>Timout);
|
||||
playCorrectSource<?php echo $live_servers_id; ?>Timout = setTimeout(function () {
|
||||
playCorrectSource<?php echo $live_servers_id; ?>();
|
||||
}, 5000);
|
||||
} else if (!$('#liveViewStatus<?php echo $live_servers_id; ?>').hasClass('isOnline') && !isOfflineVideo()) {
|
||||
if (player.readyState() <= 2) {
|
||||
console.log("Change video to offline");
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').removeClass('label-warning');
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').removeClass('label-success');
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').addClass('label-danger');
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').text("<?php echo __("OFFLINE"); ?>");
|
||||
player.pause();
|
||||
//player.reset();
|
||||
$('#mainVideo.liveVideo').find('.vjs-poster').css({'background-image': 'url(<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/Offline.jpg)'});
|
||||
$('#mainVideo.liveVideo').find('.vjs-poster').fadeIn();
|
||||
player.trigger('loadstart');
|
||||
player.posterImage.show();
|
||||
player.bigPlayButton.show();
|
||||
player.currentTime(0);
|
||||
player.on('play', function(){
|
||||
$('#mainVideo.liveVideo').find('.vjs-poster').fadeOut();
|
||||
});
|
||||
//reloadVideoJS();
|
||||
//playerPlay(0);
|
||||
} else {
|
||||
console.log("Change video to finishing");
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').removeClass('label-warning');
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').removeClass('label-success');
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').addClass('label-danger');
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').text("<?php echo __("Finishing Live..."); ?>");
|
||||
clearTimeout(playCorrectSource<?php echo $live_servers_id; ?>Timout);
|
||||
playCorrectSource<?php echo $live_servers_id; ?>Timout = setTimeout(function () {
|
||||
playCorrectSource<?php echo $live_servers_id; ?>();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getStats<?php echo $live_servers_id; ?>() {
|
||||
$.ajax({
|
||||
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Live/stats.json.php?Label',
|
||||
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Live/stats.json.php?live_servers_id=<?php echo $live_servers_id; ?>&Label',
|
||||
data: {"name": "<?php echo $streamName; ?>"},
|
||||
type: 'post',
|
||||
success: function (response) {
|
||||
if (!response.error || response.msg === "ONLINE") {
|
||||
$('#liveViewStatus').removeClass('label-danger');
|
||||
$('#liveViewStatus').addClass('label-success');
|
||||
$('#liveViewViews').removeClass('label-default');
|
||||
$('#liveViewViews').addClass('label-primary');
|
||||
$('#mainVideo.liveVideo').find('.vjs-poster').css({'background-image': 'url(<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/OnAir.jpg)'});
|
||||
if (!response.error && response.msg === "ONLINE") {
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').addClass('isOnline');
|
||||
} else {
|
||||
$('#liveViewStatus').removeClass('label-success');
|
||||
$('#liveViewStatus').addClass('label-danger');
|
||||
$('#liveViewViews').removeClass('label-primary');
|
||||
$('#liveViewViews').addClass('label-default');
|
||||
$('#mainVideo.liveVideo').find('.vjs-poster').css({'background-image': 'url(<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/Offline.jpg)'});
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').removeClass('isOnline');
|
||||
}
|
||||
playCorrectSource<?php echo $live_servers_id; ?>();
|
||||
$('.liveViewCount').text(" " + response.nclients);
|
||||
$('#liveViewStatus').text(response.msg);
|
||||
$('#liveViewStatus<?php echo $live_servers_id; ?>').text(response.msg);
|
||||
$('#onlineApplications').text(response.applications.lenght);
|
||||
setTimeout(function () {
|
||||
getStats();
|
||||
getStats<?php echo $live_servers_id; ?>();
|
||||
}, 15000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
getStats();
|
||||
getStats<?php echo $live_servers_id; ?>();
|
||||
});
|
||||
</script>
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
global $isLive;
|
||||
$isLive = 1;
|
||||
$isEmbed = 1;
|
||||
require_once '../../videos/configuration.php';
|
||||
require_once $global['systemRootPath'] . 'plugin/Live/Objects/LiveTransmition.php';
|
||||
|
||||
|
@ -26,10 +27,10 @@ if(!empty($objSecure)){
|
|||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" href="view/img/favicon.ico">
|
||||
<link rel="icon" href="<?php echo $global['webSiteRootURL']; ?>view/img/favicon.ico">
|
||||
<title><?php echo $config->getWebSiteTitle(); ?></title>
|
||||
<link href="<?php echo $global['webSiteRootURL']; ?>view/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="<?php echo $global['webSiteRootURL']; ?>view/css/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="<?php echo $global['webSiteRootURL']; ?>view/css/fontawesome-free-5.5.0-web/css/all.min.css" rel="stylesheet" type="text/css"/>
|
||||
<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/js/videojs-contrib-ads/videojs.ads.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="<?php echo $global['webSiteRootURL']; ?>view/css/player.css" rel="stylesheet" type="text/css"/>
|
||||
|
@ -46,14 +47,18 @@ if(!empty($objSecure)){
|
|||
overflow:hidden;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>';
|
||||
var player;
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="">
|
||||
<video poster="<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/OnAir.jpg" controls playsinline webkit-playsinline="webkit-playsinline"
|
||||
class="video-js vjs-default-skin vjs-big-play-centered"
|
||||
id="mainVideo" data-setup='{ "techorder" : ["flash", "html5"] }' style="width: 100%; height: 100%; position: absolute;">
|
||||
<source src="<?php echo $p->getM3U8File($uuid); ?>" type='application/x-mpegURL'>
|
||||
id="mainVideo" style="width: 100%; height: 100%; position: absolute;">
|
||||
<source src="<?php echo Live::getM3U8File($uuid); ?>" type='application/x-mpegURL'>
|
||||
</video>
|
||||
<?php
|
||||
if (AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) {
|
||||
|
@ -91,8 +96,8 @@ if(!empty($objSecure)){
|
|||
echo AVideoPlugin::afterVideoJS();
|
||||
?>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/videojs-contrib-ads/videojs.ads.min.js" type="text/javascript"></script>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/videojs-contrib-hls.min.js" type="text/javascript"></script>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/videojs-persistvolume/videojs.persistvolume.js" type="text/javascript"></script>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/script.js" type="text/javascript"></script>
|
||||
<?php
|
||||
echo AVideoPlugin::getHeadCode();
|
||||
?>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
global $isLive;
|
||||
$isLive = 1;
|
||||
$isEmbed = 1;
|
||||
require_once '../../videos/configuration.php';
|
||||
/**
|
||||
* this was made to mask the main URL
|
||||
|
@ -33,7 +34,7 @@ if(!empty($objSecure)){
|
|||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" href="view/img/favicon.ico">
|
||||
<link rel="icon" href="<?php echo $global['webSiteRootURL']; ?>view/img/favicon.ico">
|
||||
<title><?php echo $config->getWebSiteTitle(); ?> </title>
|
||||
<link href="<?php echo $global['webSiteRootURL']; ?>bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css"/>
|
||||
|
||||
|
@ -73,6 +74,10 @@ if(!empty($objSecure)){
|
|||
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>';
|
||||
var player;
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body style="background-color: black; overflow-x: hidden;">
|
||||
|
@ -85,7 +90,7 @@ if(!empty($objSecure)){
|
|||
<video poster="<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/OnAir.jpg" controls autoplay="autoplay" playsinline webkit-playsinline="webkit-playsinline"
|
||||
class="embed-responsive-item video-js vjs-default-skin vjs-big-play-centered"
|
||||
id="mainVideo" data-setup='{ "aspectRatio": "16:9", "techorder" : ["flash", "html5"] }'>
|
||||
<source src="<?php echo getM3U8File($uuid); ?>" type='application/x-mpegURL'>
|
||||
<source src="<?php echo Live::getM3U8File($uuid); ?>" type='application/x-mpegURL'>
|
||||
</video>
|
||||
<?php
|
||||
if (AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) {
|
||||
|
@ -138,8 +143,8 @@ if(!empty($objSecure)){
|
|||
</script>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>js/video.js/video.min.js" type="text/javascript"></script>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>js/videojs-contrib-ads/videojs.ads.min.js" type="text/javascript"></script>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/videojs-contrib-hls.min.js" type="text/javascript"></script>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>js/videojs-persistvolume/videojs.persistvolume.js" type="text/javascript"></script>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/script.js" type="text/javascript"></script>
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
global $isLive;
|
||||
$isLive = 1;
|
||||
$isEmbed = 1;
|
||||
$customizedAdvanced = AVideoPlugin::getObjectDataIfEnabled('CustomizeAdvanced');
|
||||
|
||||
$objSecure = AVideoPlugin::loadPluginIfEnabled('SecureVideosDirectory');
|
||||
|
@ -14,10 +15,10 @@ if (!empty($objSecure)) {
|
|||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" href="view/img/favicon.ico">
|
||||
<link rel="icon" href="<?php echo $global['webSiteRootURL']; ?>view/img/favicon.ico">
|
||||
<title><?php echo $config->getWebSiteTitle(); ?></title>
|
||||
<link href="<?php echo $global['webSiteRootURL']; ?>view/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="<?php echo $global['webSiteRootURL']; ?>view/css/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="<?php echo $global['webSiteRootURL']; ?>view/css/fontawesome-free-5.5.0-web/css/all.min.css" rel="stylesheet" type="text/css"/>
|
||||
<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/js/videojs-contrib-ads/videojs.ads.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="<?php echo $global['webSiteRootURL']; ?>view/css/player.css" rel="stylesheet" type="text/css"/>
|
||||
|
@ -37,6 +38,10 @@ if (!empty($objSecure)) {
|
|||
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>';
|
||||
var player;
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -63,8 +68,8 @@ if (!empty($objSecure)) {
|
|||
echo AVideoPlugin::afterVideoJS();
|
||||
?>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/videojs-contrib-ads/videojs.ads.min.js" type="text/javascript"></script>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/videojs-contrib-hls.min.js" type="text/javascript"></script>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/videojs-persistvolume/videojs.persistvolume.js" type="text/javascript"></script>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/script.js" type="text/javascript"></script>
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
|
|
|
@ -96,8 +96,9 @@ abstract class PluginAbstract {
|
|||
}
|
||||
|
||||
public function getDataObject() {
|
||||
if (empty(PluginAbstract::$dataObject[$this->getUUID()])) {
|
||||
$obj = Plugin::getPluginByUUID($this->getUUID());
|
||||
$uuid = $this->getUUID();
|
||||
if (empty(PluginAbstract::$dataObject[$uuid])) {
|
||||
$obj = Plugin::getPluginByUUID($uuid);
|
||||
//echo $obj['object_data'];
|
||||
$o = array();
|
||||
if (!empty($obj['object_data'])) {
|
||||
|
|
|
@ -51,49 +51,23 @@ if(empty($obj)){
|
|||
When registration approved by the admin, you will receive an email like this; <br>
|
||||
<img src="../assets/images/activated.PNG"><br><br>
|
||||
</li>
|
||||
<li>
|
||||
Signin to view the indexing module/page <br>
|
||||
<img src="../assets/images/signin.PNG"><br><br>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<b>Encountering Error</b> <br><br>
|
||||
<ul>
|
||||
<li>
|
||||
Email is already registered. Possible reason is your account isn't approve yet by the admin, just click the <b>click here</b> link (#2) to request/notify the admin about your registration again if your registration is taking more days. <br>
|
||||
Email is already registered. Possible reason is you have unsubscribe your account or your account isn't approve yet by the admin, just click <b>click here</b> (#2) to request/notify the admin about your registration again. <br>
|
||||
<img src="../assets/images/email_already_registered.PNG"><br><br>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<b> Submitting index of your platform</b> <br><br>
|
||||
<b> Submitting index of your platfor</b> <br><br>
|
||||
<ul>
|
||||
<li>
|
||||
Click the menu <b>Network Index</b> in the sidebar, then click the <b>plus sign [+] button</b> on the right side of <b>MY INDEX LIST</b>.<br>
|
||||
<img src="../assets/images/network_index_module.PNG" width="100%"><br><br>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
Change the two fields depends on what you like, only the Content Type and Country Restriction will be editable and the other four fields are auto generated.
|
||||
<img src="../assets/images/submit_index.PNG"><br><br>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<b> Index data</b> <br><br>
|
||||
<ul>
|
||||
<li>
|
||||
This will be look like when successfully submitted an index; <br>
|
||||
<b>1</b> - Edit button, to edit the content type and restriction fields <br>
|
||||
<b>2</b> - Link button, this will be the redirect link to your platform (URL) <br>
|
||||
<b>3</b> - Deactivate/Re-activate button, deactivating will remove your index to all affilates connected with and the re-activate will send an notification for activation similar when submitting new index<br>
|
||||
<b>4</b> - Active/Deactivated, Active means your index can be assigned to any affiliates and Deactivated means your index is not available to be index. <br>
|
||||
<img src="../assets/images/index_info.PNG" width="100%"><br><br>
|
||||
</li>
|
||||
<!-- <li>
|
||||
Updating data <br>
|
||||
<img src="../assets/images/index_info.PNG" width="100%"><br><br>
|
||||
</li> -->
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
|
|
|
@ -24,7 +24,7 @@ if(empty($obj)){
|
|||
include $global['systemRootPath'] . 'view/include/navbar.php';
|
||||
?>
|
||||
<div class="container-fluid">
|
||||
<iframe src="https://beta.wwbn.com/platform/?section=signup&webSiteRootURL=<?php echo urlencode($global['webSiteRootURL']); ?>" style="width: 100%; height: calc(100vh - 60px);" frameBorder="0"></iframe>
|
||||
<iframe src="https://dev4.wwbn.com/platform/?section=signup&webSiteRootURL=<?php echo urlencode($global['webSiteRootURL']); ?>" style="width: 100%; height: calc(100vh - 60px);" frameBorder="0"></iframe>
|
||||
</div>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/footer.php';
|
||||
|
|
|
@ -214,6 +214,7 @@ $(document).ready(function () {
|
|||
},
|
||||
};
|
||||
})();
|
||||
try {
|
||||
$('[data-toggle="popover"]').popover();
|
||||
$('[data-toggle="tooltip"]').tooltip({container: 'body'});
|
||||
$('[data-toggle="tooltip"]').on('click', function () {
|
||||
|
@ -222,6 +223,10 @@ $(document).ready(function () {
|
|||
$(t).tooltip('hide');
|
||||
}, 2000);
|
||||
});
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
|
||||
$(".thumbsImage").on("mouseenter", function () {
|
||||
gifId = $(this).find(".thumbsGIF").attr('id');
|
||||
$(".thumbsGIF").fadeOut();
|
||||
|
@ -728,3 +733,12 @@ function isPlayerLoop(){
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function isArray(what) {
|
||||
return Object.prototype.toString.call(what) === '[object Array]';
|
||||
}
|
||||
|
||||
function reloadVideoJS() {
|
||||
var src = player.currentSources();
|
||||
player.src(src);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue