1
0
Fork 0
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:
DanielnetoDotCom 2020-07-03 11:30:08 -03:00
parent 945890ee14
commit 5c52709d6c
60 changed files with 1868 additions and 632 deletions

View file

@ -1,76 +1,76 @@
# Contributor Covenant Code of Conduct # Contributor Covenant Code of Conduct
## Our Pledge ## Our Pledge
In the interest of fostering an open and welcoming environment, we as In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression, size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation. appearance, race, religion, or sexual identity and orientation.
## Our Standards ## Our Standards
Examples of behavior that contributes to creating a positive environment Examples of behavior that contributes to creating a positive environment
include: include:
* Using welcoming and inclusive language * Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences * Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism * Gracefully accepting constructive criticism
* Focusing on what is best for the community * Focusing on what is best for the community
* Showing empathy towards other community members * Showing empathy towards other community members
Examples of unacceptable behavior by participants include: Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or * The use of sexualized language or imagery and unwelcome sexual attention or
advances advances
* Trolling, insulting/derogatory comments, and personal or political attacks * Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment * Public or private harassment
* Publishing others' private information, such as a physical or electronic * Publishing others' private information, such as a physical or electronic
address, without explicit permission address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a * Other conduct which could reasonably be considered inappropriate in a
professional setting professional setting
## Our Responsibilities ## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior. response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate, permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful. threatening, offensive, or harmful.
## Scope ## Scope
This Code of Conduct applies both within project spaces and in public spaces This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers. further defined and clarified by project maintainers.
## Enforcement ## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at open-source[at]wwbn.com. All reported by contacting the project team at open-source[at]wwbn.com. All
complaints will be reviewed and investigated and will result in a response that complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident. obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other faith may face temporary or permanent repercussions as determined by other
members of the project's leadership. members of the project's leadership.
## Attribution ## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org [homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq https://www.contributor-covenant.org/faq

View file

@ -1,42 +1,42 @@
--- ---
name: Bug report name: Bug report
about: Create a report to help us improve about: Create a report to help us improve
title: '' title: ''
labels: bug labels: bug
assignees: '' assignees: ''
--- ---
**Describe the bug** **Describe the bug**
A clear and concise description of what the bug is. A clear and concise description of what the bug is.
**To Reproduce** **To Reproduce**
Steps to reproduce the behavior: Steps to reproduce the behavior:
1. Go to '...' 1. Go to '...'
2. Click on '....' 2. Click on '....'
3. Scroll down to '....' 3. Scroll down to '....'
4. See error 4. See error
**Expected behavior** **Expected behavior**
A clear and concise description of what you expected to happen. A clear and concise description of what you expected to happen.
**Error Logs** **Error Logs**
Provide the log files at the moment you found the issue. Provide the log files at the moment you found the issue.
If you are not sure how to find the log file, please check here https://github.com/WWBN/AVideo/wiki/How-to-find-errors-on-AVideo-Platform If you are not sure how to find the log file, please check here https://github.com/WWBN/AVideo/wiki/How-to-find-errors-on-AVideo-Platform
**Screenshots** **Screenshots**
If applicable, add screenshots to help explain your problem. If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):** **Desktop (please complete the following information):**
- OS: [e.g. iOS] - OS: [e.g. iOS]
- Browser [e.g. chrome, safari] - Browser [e.g. chrome, safari]
- Version [e.g. 22] - Version [e.g. 22]
**Smartphone (please complete the following information):** **Smartphone (please complete the following information):**
- Device: [e.g. iPhone6] - Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1] - OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari] - Browser [e.g. stock browser, safari]
- Version [e.g. 22] - Version [e.g. 22]
**Additional context** **Additional context**
Add any other context about the problem here. Add any other context about the problem here.

View file

@ -1,20 +1,20 @@
--- ---
name: Feature request name: Feature request
about: Suggest an idea for this project about: Suggest an idea for this project
title: '' title: ''
labels: enhancement labels: enhancement
assignees: '' assignees: ''
--- ---
**Is your feature request related to a problem? Please describe.** **Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like** **Describe the solution you'd like**
A clear and concise description of what you want to happen. A clear and concise description of what you want to happen.
**Describe alternatives you've considered** **Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered. A clear and concise description of any alternative solutions or features you've considered.
**Additional context** **Additional context**
Add any other context or screenshots about the feature request here. Add any other context or screenshots about the feature request here.

View file

@ -1,14 +1,14 @@
--- ---
name: Usage Questions and Help name: Usage Questions and Help
about: Feel free to make your usage question here. about: Feel free to make your usage question here.
title: '' title: ''
labels: question labels: question
assignees: '' assignees: ''
--- ---
**Describe the question** **Describe the question**
A clear and concise description of what is your question. A clear and concise description of what is your question.
**Screenshots** **Screenshots**
Provide some screenshots to help us understand and explain your problem. Provide some screenshots to help us understand and explain your problem.

42
.github/SECURITY.md vendored
View file

@ -1,21 +1,21 @@
# Security Policy # Security Policy
## Supported Versions ## Supported Versions
Use this section to tell people about which versions of your project are Use this section to tell people about which versions of your project are
currently being supported with security updates. currently being supported with security updates.
| Version | Supported | | Version | Supported |
| ------- | ------------------ | | ------- | ------------------ |
| 5.1.x | :white_check_mark: | | 5.1.x | :white_check_mark: |
| 5.0.x | :x: | | 5.0.x | :x: |
| 4.0.x | :white_check_mark: | | 4.0.x | :white_check_mark: |
| < 4.0 | :x: | | < 4.0 | :x: |
## Reporting a Vulnerability ## Reporting a Vulnerability
Use this section to tell people how to report a vulnerability. Use this section to tell people how to report a vulnerability.
Tell them where to go, how often they can expect to get an update on a Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc. declined, etc.

34
.github/stale.yml vendored
View file

@ -1,17 +1,17 @@
# Number of days of inactivity before an issue becomes stale # Number of days of inactivity before an issue becomes stale
daysUntilStale: 30 daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed # Number of days of inactivity before a stale issue is closed
daysUntilClose: 3 daysUntilClose: 3
# Issues with these labels will never be considered stale # Issues with these labels will never be considered stale
exemptLabels: exemptLabels:
- pinned - pinned
- security - security
# Label to use when marking an issue as stale # Label to use when marking an issue as stale
staleLabel: wontfix staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable # Comment to post when marking an issue as stale. Set to `false` to disable
markComment: > markComment: >
This issue has been automatically marked as stale because it has not had This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you recent activity. It will be closed if no further activity occurs. Thank you
for your contributions. for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable # Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false closeComment: false

View file

@ -0,0 +1 @@
{"error":true,"msg":"Empty filename","aVideoStorageURL":"http:\/\/ubuntu.gdrive.local\/YouPHPTube-Storage\/","filename":""}

View file

@ -325,14 +325,30 @@ class AVideoPlugin {
} }
static function getObjectData($name) { 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); $p = static::loadPlugin($name);
if ($p) { if ($p) {
return $p->getDataObject(); $pluginGetDataObject[$name] = $p->getDataObject();
return $pluginGetDataObject[$name];
} }
return false; return false;
} }
static function getObjectDataIfEnabled($name) { static function getObjectDataIfEnabled($name) {
return self::getDataObjectIfEnabled($name);
}
static function getDataObjectIfEnabled($name) {
$p = static::loadPlugin($name); $p = static::loadPlugin($name);
if ($p) { if ($p) {
$uuid = $p->getUUID(); $uuid = $p->getUUID();

View file

@ -204,10 +204,10 @@ class CustomizeAdvanced extends PluginAbstract {
if ($obj->disableNavBarInsideIframe) { if ($obj->disableNavBarInsideIframe) {
$content .= '<script>$(function () {if(inIframe()){$("#mainNavBar").fadeOut();}});</script>'; $content .= '<script>$(function () {if(inIframe()){$("#mainNavBar").fadeOut();}});</script>';
} }
if ($obj->autoHideNavbar) { if ($obj->autoHideNavbar && !isEmbed()) {
$content .= '<script>$(function () {setTimeout(function(){$("#mainNavBar").autoHidingNavbar();},5000);});</script>'; $content .= '<script>$(function () {setTimeout(function(){$("#mainNavBar").autoHidingNavbar();},5000);});</script>';
} }
if ($obj->autoHideNavbarInSeconds) { if ($obj->autoHideNavbarInSeconds && !isEmbed()) {
$content .= '<script>' $content .= '<script>'
. 'var autoHidingNavbarTimeoutMiliseconds = '.intval($obj->autoHideNavbarInSeconds*1000).';' . 'var autoHidingNavbarTimeoutMiliseconds = '.intval($obj->autoHideNavbarInSeconds*1000).';'
.file_get_contents($global['systemRootPath'] . 'plugin/CustomizeAdvanced/autoHideNavbarInSeconds.js') .file_get_contents($global['systemRootPath'] . 'plugin/CustomizeAdvanced/autoHideNavbarInSeconds.js')

View file

@ -2,34 +2,36 @@ var autoHidingNavbarTimeout;
function autoHideNavbar() { function autoHideNavbar() {
//console.log("autoHidingNavbar"); //console.log("autoHidingNavbar");
autoHidingNavbarTimeout = setTimeout(function () { autoHidingNavbarTimeout = setTimeout(function () {
$("#mainNavBar").on("show.autoHidingNavbar", function() { $("#mainNavBar").on("show.autoHidingNavbar", function () {
$('body').removeClass('nopadding'); $('body').removeClass('nopadding');
}); });
$("#mainNavBar").on("hide.autoHidingNavbar", function() { $("#mainNavBar").on("hide.autoHidingNavbar", function () {
$('body').addClass('nopadding'); $('body').addClass('nopadding');
}); });
$("#mainNavBar").autoHidingNavbar("hide"); $("#mainNavBar").autoHidingNavbar("hide");
}, autoHidingNavbarTimeoutMiliseconds); }, autoHidingNavbarTimeoutMiliseconds);
} }
$(function () { $(function () {
autoHideNavbar(); if ($("#mainNavBar").length) {
$("#mainNavBar").mouseover(function () {
//console.log("clearTimeout autoHidingNavbar");
clearTimeout(autoHidingNavbarTimeout);
});
$("#mainNavBar").mouseout(function () {
autoHideNavbar(); autoHideNavbar();
}); $("#mainNavBar").mouseover(function () {
$(document).mousemove(function (event) { //console.log("clearTimeout autoHidingNavbar");
if (event.pageY - $(document).scrollTop() <= 20) { clearTimeout(autoHidingNavbarTimeout);
$("#mainNavBar").autoHidingNavbar("show"); });
} $("#mainNavBar").mouseout(function () {
}); autoHideNavbar();
$("#mainNavBar").on("show.autoHidingNavbar", function() { });
$('body').removeClass('nopadding'); $(document).mousemove(function (event) {
}); if (event.pageY - $(document).scrollTop() <= 20) {
$("#mainNavBar").autoHidingNavbar("show");
}
});
$("#mainNavBar").on("show.autoHidingNavbar", function () {
$('body').removeClass('nopadding');
});
$("#mainNavBar").on("hide.autoHidingNavbar", function() { $("#mainNavBar").on("hide.autoHidingNavbar", function () {
$('body').addClass('nopadding'); $('body').addClass('nopadding');
}); });
}
}); });

View file

@ -4,6 +4,10 @@ global $global;
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php'; require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
require_once $global['systemRootPath'] . 'plugin/Live/Objects/LiveTransmitionHistory.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/LiveTransmitionHistoryLog.php';
require_once $global['systemRootPath'] . 'plugin/Live/Objects/Live_servers.php';
$getStatsObject = array();
$_getStats = array();
class Live extends PluginAbstract { class Live extends PluginAbstract {
@ -27,7 +31,7 @@ class Live extends PluginAbstract {
} }
public function getPluginVersion() { public function getPluginVersion() {
return "3.0"; return "4.0";
} }
public function updateScript() { public function updateScript() {
@ -45,7 +49,17 @@ class Live extends PluginAbstract {
$fetch = sqlDAL::fetchAssoc($res); $fetch = sqlDAL::fetchAssoc($res);
if (!$fetch) { if (!$fetch) {
sqlDal::writeSql(file_get_contents($global['systemRootPath'] . 'plugin/Live/install/updateV3.0.sql')); 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; return true;
} }
@ -65,8 +79,6 @@ class Live extends PluginAbstract {
$obj->button_title = "LIVE"; $obj->button_title = "LIVE";
$obj->server = "rtmp://{$server['host']}/live"; $obj->server = "rtmp://{$server['host']}/live";
$obj->playerServer = "{$scheme}://{$server['host']}:{$port}/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->stats = "{$scheme}://{$server['host']}:{$port}/stat";
$obj->disableDVR = false; $obj->disableDVR = false;
$obj->disableGifThumbs = false; $obj->disableGifThumbs = false;
@ -76,7 +88,11 @@ class Live extends PluginAbstract {
$obj->doNotShowLiveOnVideosList = false; $obj->doNotShowLiveOnVideosList = false;
$obj->doNotShowGoLiveButton = false; $obj->doNotShowGoLiveButton = false;
$obj->doNotProcessNotifications = false; $obj->doNotProcessNotifications = false;
$obj->useLiveServers = false;
$obj->hls_path = "/HLS/live"; $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; return $obj;
} }
@ -90,17 +106,72 @@ class Live extends PluginAbstract {
return $o->key; return $o->key;
} }
public function getServer() { static function getServer() {
$o = $this->getDataObject(); $obj = AVideoPlugin::getObjectData("Live");
return $o->server; 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; global $global;
$o = $this->getDataObject(); $o = AVideoPlugin::getObjectData("Live");
$playerServer = $o->playerServer; $playerServer = self::getPlayerServer();
$live_servers_id = self::getLiveServersIdRequest();
if ($o->protectLive) { 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) { } else if ($o->useAadaptiveMode) {
return $playerServer . "/{$uuid}.m3u8"; return $playerServer . "/{$uuid}.m3u8";
} else { } else {
@ -113,8 +184,15 @@ class Live extends PluginAbstract {
return $o->disableGifThumbs; return $o->disableGifThumbs;
} }
public function getStatsURL() { public function getStatsURL($live_servers_id = 0) {
global $global;
$o = $this->getDataObject(); $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; 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(); $o = $this->getDataObject();
if ($o->doNotProcessNotifications) { if ($o->doNotProcessNotifications) {
$xml = new stdClass(); $xml = new stdClass();
@ -136,13 +218,48 @@ class Live extends PluginAbstract {
$xml->server->application = array(); $xml->server->application = array();
return $xml; return $xml;
} }
if(empty($o->requestStatsTimout)){
$o->requestStatsTimout = 2;
}
ini_set('allow_url_fopen ', 'ON'); 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; return $xml;
} }
function get_data($url) { function get_data($url, $timeout) {
return url_get_contents($url, "", 5); try {
return @url_get_contents($url, "", $timeout);
} catch (Exception $exc) {
_error_log($exc->getTraceAsString());
}
return false;
} }
public function getTags() { public function getTags() {
@ -166,27 +283,27 @@ class Live extends PluginAbstract {
LiveTransmitionHistoryLog::addLog($latest['id']); LiveTransmitionHistoryLog::addLog($latest['id']);
} }
} }
public function dataSetup() { public function dataSetup() {
$obj = $this->getDataObject(); $obj = $this->getDataObject();
if(!isLive() || $obj->disableDVR){ if (!isLive() || $obj->disableDVR) {
return ""; return "";
} }
return "liveui: true"; return "liveui: true";
} }
static function stopLive($users_id) { static function stopLive($users_id) {
if(!User::isAdmin() && User::getId() != $users_id){ if (!User::isAdmin() && User::getId() != $users_id) {
return false; return false;
} }
$obj = AVideoPlugin::getObjectData("Live"); $obj = AVideoPlugin::getObjectData("Live");
if (!empty($obj)) { if (!empty($obj)) {
$server = str_replace("stats", "", $obj->stats); $server = str_replace("stats", "", $obj->stats);
$lt = new LiveTransmition(0); $lt = new LiveTransmition(0);
$lt->loadByUser($users_id); $lt->loadByUser($users_id);
$key = $lt->getKey(); $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); url_get_contents($url);
$dir = $obj->hls_path . "/$key"; $dir = $obj->hls_path . "/$key";
if (is_dir($dir)) { if (is_dir($dir)) {
@ -195,59 +312,242 @@ class Live extends PluginAbstract {
} }
} }
} }
// not implemented yet // not implemented yet
static function startRecording($users_id) { static function startRecording($users_id) {
if(!User::isAdmin() && User::getId() != $users_id){ if (!User::isAdmin() && User::getId() != $users_id) {
return false; return false;
} }
$obj = AVideoPlugin::getObjectData("Live"); $obj = AVideoPlugin::getObjectData("Live");
if (!empty($obj)) { if (!empty($obj)) {
$server = str_replace("stats", "", $obj->stats); $server = str_replace("stats", "", $obj->stats);
$lt = new LiveTransmition(0); $lt = new LiveTransmition(0);
$lt->loadByUser($users_id); $lt->loadByUser($users_id);
$key = $lt->getKey(); $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); 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 // not implemented yet
static function stopRecording($users_id) { static function stopRecording($users_id) {
if(!User::isAdmin() && User::getId() != $users_id){ if (!User::isAdmin() && User::getId() != $users_id) {
return false; return false;
} }
$obj = AVideoPlugin::getObjectData("Live"); $obj = AVideoPlugin::getObjectData("Live");
if (!empty($obj)) { if (!empty($obj)) {
$server = str_replace("stats", "", $obj->stats); $server = str_replace("stats", "", $obj->stats);
$lt = new LiveTransmition(0); $lt = new LiveTransmition(0);
$lt->loadByUser($users_id); $lt->loadByUser($users_id);
$key = $lt->getKey(); $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); url_get_contents($url);
} }
} }
static function getLinkToLiveFromUsers_id($users_id){ static function getLinkToLiveFromUsers_id($users_id) {
if(empty($users_id)){ if (empty($users_id)) {
return false; return false;
} }
global $global; global $global;
$user = new User($users_id); $user = new User($users_id);
if(empty($user)){ if (empty($user)) {
return false; 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());
} }
public function getVideosManagerListButtonTitle(){ 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() {
global $global; global $global;
if(!User::isAdmin()){ if (!User::isAdmin()) {
return ""; return "";
} }
$btn = '<br><button type="button" class="btn btn-default btn-light btn-sm btn-xs" onclick="document.location = \\\''.$global['webSiteRootURL'].'plugin/Live/?users_id=\' + row.users_id + \'\\\';" data-row-id="right" data-toggle="tooltip" data-placement="left" title="Extract images from your video"><i class="fa fa-circle"></i> Live Info</button>'; $btn = '<br><button type="button" class="btn btn-default btn-light btn-sm btn-xs" onclick="document.location = \\\'' . $global['webSiteRootURL'] . 'plugin/Live/?users_id=\' + row.users_id + \'\\\';" data-row-id="right" data-toggle="tooltip" data-placement="left" title="Extract images from your video"><i class="fa fa-circle"></i> Live Info</button>';
return $btn; 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;
}
} }

View file

@ -6,7 +6,7 @@ require_once dirname(__FILE__) . '/../../../objects/user.php';
class LiveTransmitionHistory extends ObjectYPT { 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() { static function getSearchFieldsNames() {
return array('title', 'description'); return array('title', 'description');
@ -76,6 +76,14 @@ class LiveTransmitionHistory extends ObjectYPT {
$this->users_id = $users_id; $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){ function getAllFromUser($users_id){
global $global; global $global;
$sql = "SELECT * FROM " . static::getTableName() . " WHERE users_id = ? "; $sql = "SELECT * FROM " . static::getTableName() . " WHERE users_id = ? ";
@ -115,6 +123,11 @@ class LiveTransmitionHistory extends ObjectYPT {
public function save() { public function save() {
AVideoPlugin::onLiveStream($this->users_id); AVideoPlugin::onLiveStream($this->users_id);
if(empty($this->live_servers_id)){
$this->live_servers_id = 'NULL';
}
return parent::save(); return parent::save();
} }

View 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;
}
}

Binary file not shown.

Binary file not shown.

View file

@ -34,7 +34,7 @@ _error_log("Live:getImage start");
if($lt->userCanSeeTransmition()){ if($lt->userCanSeeTransmition()){
$uuid = $livet['key']; $uuid = $livet['key'];
$p = AVideoPlugin::loadPlugin("Live"); $p = AVideoPlugin::loadPlugin("Live");
$video = "{$p->getM3U8File($uuid)}"; $video = Live::getM3U8File($uuid);
$url = $config->getEncoderURL()."getImage/". base64_encode($video)."/{$_GET['format']}"; $url = $config->getEncoderURL()."getImage/". base64_encode($video)."/{$_GET['format']}";
_error_log("Live:getImage $url"); _error_log("Live:getImage $url");

View 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);

View file

@ -1,7 +1,7 @@
<?php <?php
require_once '../../videos/configuration.php'; require_once '../../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
$isLive = 1;
$p = AVideoPlugin::loadPlugin("Live"); $p = AVideoPlugin::loadPlugin("Live");
if (!empty($_GET['c'])) { if (!empty($_GET['c'])) {
@ -35,7 +35,7 @@ require_once $global['systemRootPath'] . 'objects/functions.php';
require_once $global['systemRootPath'] . 'plugin/Live/Objects/LiveTransmition.php'; require_once $global['systemRootPath'] . 'plugin/Live/Objects/LiveTransmition.php';
$users_id = User::getId(); $users_id = User::getId();
if(!empty($_GET['users_id']) && User::isAdmin()){ if (!empty($_GET['users_id']) && User::isAdmin()) {
$users_id = intval($_GET['users_id']); $users_id = intval($_GET['users_id']);
} }
@ -81,141 +81,169 @@ if (empty($channelName)) {
include $global['systemRootPath'] . 'view/include/navbar.php'; include $global['systemRootPath'] . 'view/include/navbar.php';
?> ?>
<div class="container"> <div class="container">
<div class="col-md-6" id="yptRightBar"> <div class="panel panel-default">
<?php <div class="panel-heading">
if (!empty($obj->experimentalWebcam)) { <ul class="nav nav-tabs">
?>
<div class="panel panel-default">
<div class="panel-heading"><?php echo __("WebCam Streaming"); ?></div>
<div class="panel-body">
<div class="embed-responsive embed-responsive-16by9">
<div class="embed-responsive-item" id="webcam">
<button class="btn btn-primary btn-block" id="enableWebCam">
<i class="fa fa-camera"></i> <?php echo __("Enable WebCam Stream"); ?>
</button>
<div class="alert alert-warning">
<i class="fa fa-warning"><?php echo __("We will check if there is a stream conflict before stream"); ?></i>
</div>
<div class="alert alert-info">
<?php echo __("This is an experimental resource"); ?>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
<div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-share"></i> <?php echo __("Share Info"); ?> (<?php echo $channelName; ?>)</div>
<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">
</div>
<div class="form-group">
<label for="avideoURL"><i class="fa fa-circle"></i> <?php echo __("Live URL"); ?>:</label>
<input type="text" class="form-control" id="avideoURL" value="<?php echo Live::getLinkToLiveFromUsers_id($users_id); ?>" readonly="readonly">
</div>
<div class="form-group">
<label for="embedStream"><i class="fa fa-code"></i> <?php echo __("Embed Stream"); ?>:</label>
<input type="text" class="form-control" id="embedStream" value='<iframe width="640" height="480" style="max-width: 100%;max-height: 100%;" src="<?php echo Live::getLinkToLiveFromUsers_id($users_id); ?>&embed=1" frameborder="0" allowfullscreen="allowfullscreen" ></iframe>' readonly="readonly">
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-hdd"></i> <?php echo __("Devices Stream Info"); ?> (<?php echo $channelName; ?>)</div>
<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">
<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">
<label for="streamkey"><i class="fa fa-key"></i> <?php echo __("Stream name/key"); ?>:</label>
<div class="input-group">
<input type="text" class="form-control" id="streamkey" value="<?php echo $trasnmition['key']; ?>" readonly="readonly">
<span class="input-group-btn">
<a class="btn btn-default" href="<?php echo $global['webSiteRootURL']; ?>plugin/Live/?resetKey=1"><i class="fa fa-refresh"></i> <?php echo __("Reset Key"); ?></a>
</span>
</div>
</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">
<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>
</div>
<?php
AVideoPlugin::getLivePanel();
?>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<?php <?php
$streamName = $trasnmition['key']; $servers = Live::getAllServers();
include $global['systemRootPath'] . 'plugin/Live/view/onlineLabel.php'; $_REQUEST['live_servers_id'] = Live::getLiveServersIdRequest();
?> foreach ($servers as $key => $value) {
</div> $active = "";
<div class="panel-body"> if ($_REQUEST['live_servers_id']) {
<div class="embed-responsive embed-responsive-16by9"> if ($_REQUEST['live_servers_id'] == $value['id']) {
<video poster="<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/OnAir.jpg" controls $active = "active";
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"] }'> } else if ($key == 0) {
<source src="<?php echo $p->getM3U8File($trasnmition['key']); ?>" type='application/x-mpegURL'> $_REQUEST['live_servers_id'] = $value['id'];
</video> $active = "active";
</div> }
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><?php echo __("Stream Settings"); ?></div>
<div class="panel-body">
<div class="form-group">
<label for="title"><?php echo __("Title"); ?>:</label>
<input type="text" class="form-control" id="title" value="<?php echo $trasnmition['title'] ?>">
</div>
<div class="form-group">
<label for="description"><?php echo __("Description"); ?>:</label>
<textarea class="form-control" id="description"><?php echo $trasnmition['description'] ?></textarea>
</div>
<!--
-->
<hr>
<div class="form-group">
<span class="fa fa-globe"></span> <?php echo __("Make Stream Publicly Listed"); ?>
<b>(<?php echo __("MAKE SURE YOU CLICK SAVE"); ?>)</b>
<div class="material-switch pull-right">
<input id="listed" type="checkbox" value="1" <?php echo!empty($trasnmition['public']) ? "checked" : ""; ?>/>
<label for="listed" class="label-success"></label>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><?php echo __("Groups That Can See This Stream"); ?><br><small><?php echo __("Uncheck all to make it public"); ?></small></div>
<div class="panel-body">
<?php
$ug = UserGroups::getAllUsersGroups();
foreach ($ug as $value) {
?> ?>
<div class="form-group"> <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>
<span class="fa fa-users"></span> <?php echo $value['group_name']; ?> <?php
<div class="material-switch pull-right"> }
<input id="group<?php echo $value['id']; ?>" type="checkbox" value="<?php echo $value['id']; ?>" class="userGroups" <?php echo (in_array($value['id'], $groups) ? "checked" : "") ?>/> ?>
<label for="group<?php echo $value['id']; ?>" class="label-success"></label> </ul>
</div>
<div class="panel-body">
<div class="col-md-6" id="yptRightBar">
<?php
if (!empty($obj->experimentalWebcam)) {
?>
<div class="panel panel-default">
<div class="panel-heading"><?php echo __("WebCam Streaming"); ?></div>
<div class="panel-body">
<div class="embed-responsive embed-responsive-16by9">
<div class="embed-responsive-item" id="webcam">
<button class="btn btn-primary btn-block" id="enableWebCam">
<i class="fa fa-camera"></i> <?php echo __("Enable WebCam Stream"); ?>
</button>
<div class="alert alert-warning">
<i class="fa fa-warning"><?php echo __("We will check if there is a stream conflict before stream"); ?></i>
</div>
<div class="alert alert-info">
<?php echo __("This is an experimental resource"); ?>
</div>
</div>
</div>
</div> </div>
</div> </div>
<?php <?php
} }
?> ?>
<button type="button" class="btn btn-success" id="btnSaveStream"><?php echo __("Save Stream"); ?></button> <div class="panel panel-default">
<a href="<?php echo $global['webSiteRootURL']; ?>usersGroups" class="btn btn-primary"><span class="fa fa-users"></span> <?php echo __("Add more user Groups"); ?></a> <div class="panel-heading"><i class="fa fa-share"></i> <?php echo __("Share Info"); ?> (<?php echo $channelName; ?>)</div>
<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 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>
<input type="text" class="form-control" id="avideoURL" value="<?php echo Live::getLinkToLiveFromUsers_id($users_id); ?>" readonly="readonly">
</div>
<div class="form-group">
<label for="embedStream"><i class="fa fa-code"></i> <?php echo __("Embed Stream"); ?>:</label>
<input type="text" class="form-control" id="embedStream" value='<iframe width="640" height="480" style="max-width: 100%;max-height: 100%;" src="<?php echo Live::getLinkToLiveFromUsers_id($users_id); ?>&embed=1" frameborder="0" allowfullscreen="allowfullscreen" ></iframe>' readonly="readonly">
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-hdd"></i> <?php echo __("Devices Stream Info"); ?> (<?php echo $channelName; ?>)</div>
<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 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">
<label for="streamkey"><i class="fa fa-key"></i> <?php echo __("Stream name/key"); ?>:</label>
<div class="input-group">
<input type="text" class="form-control" id="streamkey" value="<?php echo $trasnmition['key']; ?>" readonly="readonly">
<span class="input-group-btn">
<a class="btn btn-default" href="<?php echo $global['webSiteRootURL']; ?>plugin/Live/?resetKey=1"><i class="fa fa-refresh"></i> <?php echo __("Reset Key"); ?></a>
</span>
</div>
</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 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>
</div>
<?php
AVideoPlugin::getLivePanel();
?>
</div> </div>
</div> <div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<?php
$streamName = $trasnmition['key'];
include $global['systemRootPath'] . 'plugin/Live/view/onlineLabel.php';
?>
</div>
<div class="panel-body">
<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" >
<source src="<?php echo Live::getM3U8File($trasnmition['key']); ?>" type='application/x-mpegURL'>
</video>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><?php echo __("Stream Settings"); ?></div>
<div class="panel-body">
<div class="form-group">
<label for="title"><?php echo __("Title"); ?>:</label>
<input type="text" class="form-control" id="title" value="<?php echo $trasnmition['title'] ?>">
</div>
<div class="form-group">
<label for="description"><?php echo __("Description"); ?>:</label>
<textarea class="form-control" id="description"><?php echo $trasnmition['description'] ?></textarea>
</div>
<!--
-->
<hr>
<div class="form-group">
<span class="fa fa-globe"></span> <?php echo __("Make Stream Publicly Listed"); ?>
<b>(<?php echo __("MAKE SURE YOU CLICK SAVE"); ?>)</b>
<div class="material-switch pull-right">
<input id="listed" type="checkbox" value="1" <?php echo!empty($trasnmition['public']) ? "checked" : ""; ?>/>
<label for="listed" class="label-success"></label>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><?php echo __("Groups That Can See This Stream"); ?><br><small><?php echo __("Uncheck all to make it public"); ?></small></div>
<div class="panel-body">
<?php
$ug = UserGroups::getAllUsersGroups();
foreach ($ug as $value) {
?>
<div class="form-group">
<span class="fa fa-users"></span> <?php echo $value['group_name']; ?>
<div class="material-switch pull-right">
<input id="group<?php echo $value['id']; ?>" type="checkbox" value="<?php echo $value['id']; ?>" class="userGroups" <?php echo (in_array($value['id'], $groups) ? "checked" : "") ?>/>
<label for="group<?php echo $value['id']; ?>" class="label-success"></label>
</div>
</div>
<?php
}
?>
<button type="button" class="btn btn-success" id="btnSaveStream"><?php echo __("Save Stream"); ?></button>
<a href="<?php echo $global['webSiteRootURL']; ?>usersGroups" class="btn btn-primary"><span class="fa fa-users"></span> <?php echo __("Add more user Groups"); ?></a>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
<?php <?php
@ -225,7 +253,7 @@ if (empty($channelName)) {
include $global['systemRootPath'] . 'view/include/footer.php'; include $global['systemRootPath'] . 'view/include/footer.php';
?> ?>
<script> <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 params = {};
var attributes = {}; var attributes = {};
function amIOnline() { function amIOnline() {
@ -282,6 +310,9 @@ if (empty($channelName)) {
$('#enableWebCam').click(function () { $('#enableWebCam').click(function () {
amIOnline(); amIOnline();
}); });
if (typeof player === 'undefined') {
player = videojs('mainVideo'<?php echo PlayerSkins::getDataSetup(); ?>);
}
}); });
</script> </script>
</body> </body>

View file

@ -72,8 +72,10 @@ CREATE TABLE IF NOT EXISTS `live_transmitions_history` (
`created` DATETIME NULL, `created` DATETIME NULL,
`modified` DATETIME NULL, `modified` DATETIME NULL,
`users_id` INT(11) NOT NULL, `users_id` INT(11) NOT NULL,
`live_servers_id` INT(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
INDEX `fk_live_transmitions_history_users_idx` (`users_id` ASC), 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` CONSTRAINT `fk_live_transmitions_history_users`
FOREIGN KEY (`users_id`) FOREIGN KEY (`users_id`)
REFERENCES `users` (`id`) REFERENCES `users` (`id`)
@ -97,6 +99,27 @@ CREATE TABLE IF NOT EXISTS `live_transmition_history_log` (
ON UPDATE NO ACTION) ON UPDATE NO ACTION)
ENGINE = InnoDB; 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 SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;

View 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;

View file

@ -1,7 +1,7 @@
<?php <?php
$recheckTolerance = 600; // 10 min $recheckTolerance = 600; // 10 min
require_once '../../videos/configuration.php'; require_once '../../videos/configuration.php';
error_reporting(0);
session_write_close(); session_write_close();
if (empty($_GET['uuid'])) { if (empty($_GET['uuid'])) {
@ -31,24 +31,55 @@ if (empty($_SESSION['m3u8Verified']) || $_SESSION['m3u8Verified'] + $recheckTole
} }
unset($_SESSION['m3u8Verified']); 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(); _session_start();
$obj = AVideoPlugin::getObjectData('Live'); $obj = AVideoPlugin::getObjectData('Live');
$_SESSION['playerServer'] = $obj->playerServer; $_SESSION['playerServer'][$live_servers_id] = Live::getPlayerServer();
$_SESSION['useAadaptiveMode'] = $obj->useAadaptiveMode; $_SESSION['useAadaptiveMode'][$live_servers_id] = Live::getUseAadaptiveMode();
} else { } else {
@$global['mysqli']->close(); @$global['mysqli']->close();
} }
if ($_SESSION['useAadaptiveMode']) { if ($_SESSION['useAadaptiveMode'][$live_servers_id]) {
$complement = $_SESSION['playerServer'] . "/"; $complement = $_SESSION['playerServer'][$live_servers_id] . "/";
$url = $_SESSION['playerServer'] . "/{$uuid}.m3u8"; $url = $_SESSION['playerServer'][$live_servers_id] . "/{$uuid}.m3u8";
$content = url_get_contents($url); $content = url_get_contents($url);
} }
if (empty($content)) { if (empty($content)) {
$complement = $_SESSION['playerServer'] . "/{$uuid}/"; $complement = $_SESSION['playerServer'][$live_servers_id] . "/{$uuid}/";
$url = $_SESSION['playerServer'] . "/{$uuid}/index.m3u8"; $url = $_SESSION['playerServer'][$live_servers_id] . "/{$uuid}/index.m3u8";
$content = url_get_contents($url); $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'])) { if (empty($_SESSION['m3u8Verified'])) {
@ -57,7 +88,7 @@ if (empty($_SESSION['m3u8Verified'])) {
} }
$lines = preg_split("/((\r?\n)|(\r\n?))/", $content); $lines = preg_split("/((\r?\n)|(\r\n?))/", $content);
for ($i = 0; $i < count($lines); $i++) { 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 $complement;
} }
echo $lines[$i] . PHP_EOL; echo $lines[$i] . PHP_EOL;

View file

@ -56,6 +56,7 @@ if (!empty($_GET['p'])) {
$lth->setDescription($obj->row['description']); $lth->setDescription($obj->row['description']);
$lth->setKey($_POST['name']); $lth->setKey($_POST['name']);
$lth->setUsers_id($user->getBdId()); $lth->setUsers_id($user->getBdId());
$lth->setLive_servers_id(Live_servers::getServerIdFromRTMPHost($url));
_error_log("NGINX ON Publish saving LiveTransmitionHistory"); _error_log("NGINX ON Publish saving LiveTransmitionHistory");
$lth->save(); $lth->save();
_error_log("NGINX ON Publish saved LiveTransmitionHistory"); _error_log("NGINX ON Publish saved LiveTransmitionHistory");

View file

@ -1,98 +1,20 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
require_once '../../videos/configuration.php'; 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); ini_set('max_execution_time', 10);
set_time_limit(10); set_time_limit(10);
$obj = new stdClass(); session_write_close();
$obj->error = true; $pobj = AVideoPlugin::getDataObjectIfEnabled("Live");
$obj->msg = "OFFLINE";
$obj->nclients = 0; if (empty($pobj)) {
if(empty($_POST['name']) && !empty($_GET['name'])){ die(json_encode("Plugin disabled"));
$_POST['name'] = $_GET['name'];
}else if(empty($_POST['name'])){
$_POST['name'] = "undefined";
} }
$obj->name = $_POST['name']; $live_servers_id = Live::getCurrentLiveServersId();
$obj->applications = array(); $cacheName = "statsCache_{$live_servers_id}_".md5($global['systemRootPath']);
$_GET['lifetime'] = "10"; $json = ObjectYPT::getCache($cacheName, $pobj->cacheStatsTimout);
if(empty($p)){ if(empty($json)){
die(json_encode($obj)); $json = json_encode(Live::getStats());
ObjectYPT::setCache($cacheName, $json);
} }
$xml = $p->getStatsObject(); echo $json;
$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;
}
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;
}
}
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';

View 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);

View 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));
?>

View 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>

View 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>

View 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"/>

View 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); ?>}

View 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>

View file

@ -15,7 +15,7 @@
<video poster="<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/OnAir.jpg" controls playsinline webkit-playsinline="webkit-playsinline" <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" class="embed-responsive-item video-js vjs-default-skin vjs-big-play-centered liveVideo vjs-16-9"
id="mainVideo"> 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> </video>
<?php <?php
if (AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) { if (AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) {

View file

@ -0,0 +1 @@
<EFBFBD>%M/> <09><><EFBFBD><EFBFBD><EFBFBD>a<EFBFBD>

View 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

View 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; ?>

View 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);
?>

View 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

View file

@ -0,0 +1,4 @@
<?php
include '../index.m3u8.php';
?>

Binary file not shown.

Binary file not shown.

View 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

View file

@ -0,0 +1,4 @@
<?php
include '../index.m3u8.php';
?>

Binary file not shown.

Binary file not shown.

View 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

View file

@ -0,0 +1,4 @@
<?php
include '../index.m3u8.php';
?>

Binary file not shown.

Binary file not shown.

View 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

View file

@ -0,0 +1,4 @@
<?php
include '../index.m3u8.php';
?>

Binary file not shown.

Binary file not shown.

View file

@ -12,6 +12,8 @@
#availableLiveStream{ #availableLiveStream{
max-width: 400px; max-width: 400px;
overflow: hidden; overflow: hidden;
max-height: 75vh;
overflow-y: auto;
} }
#availableLiveStream li a div{ #availableLiveStream li a div{
overflow: hidden; overflow: hidden;
@ -69,7 +71,7 @@ if (empty($obj->doNotShowGoLiveButton) && User::canStream()) {
require_once $global['systemRootPath'] . 'plugin/AVideoPlugin.php'; require_once $global['systemRootPath'] . 'plugin/AVideoPlugin.php';
// the live users plugin // the live users plugin
$lu = AVideoPlugin::getObjectDataIfEnabled("LiveUsers"); $lu = AVideoPlugin::getObjectDataIfEnabled("LiveUsers");
if(!empty($lu) && !$lu->doNotDisplayCounter){ if (!empty($lu) && !$lu->doNotDisplayCounter) {
?> ?>
<span class="label label-primary" data-toggle="tooltip" title="<?php echo __("Watching Now"); ?>" data-placement="bottom" ><i class="fa fa-user"></i> <b class="liveUsersOnline">0</b></span> <span class="label label-primary" data-toggle="tooltip" title="<?php echo __("Watching Now"); ?>" data-placement="bottom" ><i class="fa fa-user"></i> <b class="liveUsersOnline">0</b></span>
<span class="label label-default" data-toggle="tooltip" title="<?php echo __("Total Views"); ?>" data-placement="bottom" ><i class="fa fa-eye"></i> <b class="liveUsersViews">0</b></span> <span class="label label-default" data-toggle="tooltip" title="<?php echo __("Total Views"); ?>" data-placement="bottom" ><i class="fa fa-eye"></i> <b class="liveUsersViews">0</b></span>
@ -93,7 +95,7 @@ if (empty($obj->doNotShowGoLiveButton) && User::canStream()) {
$liveLi.find('.liveUser').removeClass("label-success").addClass("label-danger"); $liveLi.find('.liveUser').removeClass("label-success").addClass("label-danger");
$liveLi.find('.badge').text("offline"); $liveLi.find('.badge').text("offline");
//$('#mainVideo.liveVideo').find('.vjs-poster').css({'background-image': 'url(<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/Offline.jpg)'}); //$('#mainVideo.liveVideo').find('.vjs-poster').css({'background-image': 'url(<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/Offline.jpg)'});
}else{ } else {
//$('#mainVideo.liveVideo').find('.vjs-poster').css({'background-image': 'url(<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/OnAir.jpg)'}); //$('#mainVideo.liveVideo').find('.vjs-poster').css({'background-image': 'url(<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/OnAir.jpg)'});
} }
$liveLi.removeClass("hidden").removeClass("liveModel"); $liveLi.removeClass("hidden").removeClass("liveModel");
@ -111,8 +113,8 @@ if (empty($obj->doNotShowGoLiveButton) && User::canStream()) {
$('.liveUsersViews_' + key).text(views); $('.liveUsersViews_' + key).text(views);
} }
function createExtraVideos(href, title, name, photo, user, online, views, key, disableGif) { function createExtraVideos(href, title, name, photo, user, online, views, key, disableGif, live_servers_id) {
var id = 'extraVideo' + user; var id = 'extraVideo' + user + "_" + live_servers_id;
id = id.replace(/\W/g, ''); id = id.replace(/\W/g, '');
if ($(".extraVideos").length && $("#" + id).length == 0) { if ($(".extraVideos").length && $("#" + id).length == 0) {
var $liveLi = $('.extraVideosModel').clone(); var $liveLi = $('.extraVideosModel').clone();
@ -127,9 +129,9 @@ if (empty($obj->doNotShowGoLiveButton) && User::canStream()) {
$liveLi.find('.liveUsersViews').text(views); $liveLi.find('.liveUsersViews').text(views);
$liveLi.find('.liveUsersOnline').addClass("liveUsersOnline_" + key); $liveLi.find('.liveUsersOnline').addClass("liveUsersOnline_" + key);
$liveLi.find('.liveUsersViews').addClass("liveUsersViews_" + 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) { 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 { } else {
$liveLi.find('.thumbsGIF').remove(); $liveLi.find('.thumbsGIF').remove();
} }
@ -140,59 +142,99 @@ if (empty($obj->doNotShowGoLiveButton) && User::canStream()) {
} }
function getStatsMenu(recurrentCall) { function getStatsMenu(recurrentCall) {
availableLiveStreamIsLoading();
$.ajax({ $.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) { success: function (response) {
if (typeof response.applications !== 'undefined') { if (typeof response !== 'undefined') {
$('.onlineApplications').text(response.applications.length); var total = 0;
$('#availableLiveStream').empty(); $('#availableLiveStream').empty();
if (response.applications.length) { if (isArray(response)) {
disableGif = response.disableGif; for (var i in response) {
for (i = 0; i < response.applications.length; i++) { if (typeof response[i] !== 'object') {
if (typeof response.applications[i].html != 'undefined') { continue;
$('#availableLiveStream').append(response.applications[i].html);
if (typeof response.applications[i].htmlExtra != 'undefined') {
var id = $(response.applications[i].htmlExtra).attr('id');
if (loadedExtraVideos.indexOf(id) == -1) {
loadedExtraVideos.push(id)
$('.extraVideos').append(response.applications[i].htmlExtra);
}
}
$('#liveVideos').slideDown();
} else {
href = "<?php echo $global['webSiteRootURL']; ?>plugin/Live/?c=" + response.applications[i].channelName;
title = response.applications[i].title;
name = response.applications[i].name;
user = response.applications[i].user;
photo = response.applications[i].photo;
online = response.applications[i].users.online;
views = response.applications[i].users.views;
key = response.applications[i].key;
createLiveItem(href, title, name, photo, false, online, views, key);
<?php
if(empty($obj->doNotShowLiveOnVideosList)){
?>
createExtraVideos(href, title, name, photo, user, online, views, key, disableGif);
<?php
}
?>
}
}
mouseEffect();
} else {
createLiveItem("#", "<?php echo __("There is no streaming now"); ?>", "", "", true);
}
} }
if (recurrentCall) { total += response[i].applications.length;
setTimeout(function () { processApplicationLive(response[i]);
getStatsMenu(true); }
}, 10000); } 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++) {
if (typeof response.applications[i].html != 'undefined') {
$('#availableLiveStream').append(response.applications[i].html);
if (typeof response.applications[i].htmlExtra != 'undefined') {
var id = $(response.applications[i].htmlExtra).attr('id');
if (loadedExtraVideos.indexOf(id) == -1) {
loadedExtraVideos.push(id)
$('.extraVideos').append(response.applications[i].htmlExtra);
} }
} }
}); $('#liveVideos').slideDown();
} else {
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;
photo = response.applications[i].photo;
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, live_servers_id);
<?php
}
?>
}
} }
mouseEffect();
}
}
}
$(document).ready(function () { function availableLiveStreamIsLoading() {
getStatsMenu(true); 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);
$('#availableLiveStream').find('.liveLink div').attr('style', '');
}
$(document).ready(function () {
availableLiveStreamIsLoading();
getStatsMenu(true);
});
</script> </script>

View file

@ -1,39 +1,107 @@
<?php
<span class="label label-danger" id="liveViewStatus">OFFLINE</span> $live_servers_id = Live::getCurrentLiveServersId();
<!-- ?>
<span class="label label-default" id="liveViewViews"><i class="fa fa-eye"></i> <span class="liveViewCount" style="font-size: 0.9em;">0</span></span> <span class="label label-danger" id="liveViewStatus<?php echo $live_servers_id; ?>">OFFLINE</span>
-->
<script> <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({ $.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; ?>"}, data: {"name": "<?php echo $streamName; ?>"},
type: 'post', type: 'post',
success: function (response) { success: function (response) {
if (!response.error || response.msg === "ONLINE") { if (!response.error && response.msg === "ONLINE") {
$('#liveViewStatus').removeClass('label-danger'); $('#liveViewStatus<?php echo $live_servers_id; ?>').addClass('isOnline');
$('#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)'});
} else { } else {
$('#liveViewStatus').removeClass('label-success'); $('#liveViewStatus<?php echo $live_servers_id; ?>').removeClass('isOnline');
$('#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)'});
} }
playCorrectSource<?php echo $live_servers_id; ?>();
$('.liveViewCount').text(" " + response.nclients); $('.liveViewCount').text(" " + response.nclients);
$('#liveViewStatus').text(response.msg); $('#liveViewStatus<?php echo $live_servers_id; ?>').text(response.msg);
$('#onlineApplications').text(response.applications.lenght); $('#onlineApplications').text(response.applications.lenght);
setTimeout(function () { setTimeout(function () {
getStats(); getStats<?php echo $live_servers_id; ?>();
}, 15000); }, 15000);
} }
}); });
} }
$(document).ready(function () { $(document).ready(function () {
getStats(); getStats<?php echo $live_servers_id; ?>();
}); });
</script> </script>

View file

@ -1,6 +1,7 @@
<?php <?php
global $isLive; global $isLive;
$isLive = 1; $isLive = 1;
$isEmbed = 1;
require_once '../../videos/configuration.php'; require_once '../../videos/configuration.php';
require_once $global['systemRootPath'] . 'plugin/Live/Objects/LiveTransmition.php'; require_once $global['systemRootPath'] . 'plugin/Live/Objects/LiveTransmition.php';
@ -26,10 +27,10 @@ if(!empty($objSecure)){
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <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> <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/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/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/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"/> <link href="<?php echo $global['webSiteRootURL']; ?>view/css/player.css" rel="stylesheet" type="text/css"/>
@ -46,14 +47,18 @@ if(!empty($objSecure)){
overflow:hidden; overflow:hidden;
} }
</style> </style>
<script>
var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>';
var player;
</script>
</head> </head>
<body> <body>
<div class=""> <div class="">
<video poster="<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/OnAir.jpg" controls playsinline webkit-playsinline="webkit-playsinline" <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" class="video-js vjs-default-skin vjs-big-play-centered"
id="mainVideo" data-setup='{ "techorder" : ["flash", "html5"] }' style="width: 100%; height: 100%; position: absolute;"> id="mainVideo" style="width: 100%; height: 100%; position: absolute;">
<source src="<?php echo $p->getM3U8File($uuid); ?>" type='application/x-mpegURL'> <source src="<?php echo Live::getM3U8File($uuid); ?>" type='application/x-mpegURL'>
</video> </video>
<?php <?php
if (AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) { if (AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) {
@ -91,8 +96,8 @@ if(!empty($objSecure)){
echo AVideoPlugin::afterVideoJS(); 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']; ?>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/videojs-persistvolume/videojs.persistvolume.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/script.js" type="text/javascript"></script>
<?php <?php
echo AVideoPlugin::getHeadCode(); echo AVideoPlugin::getHeadCode();
?> ?>

View file

@ -1,6 +1,7 @@
<?php <?php
global $isLive; global $isLive;
$isLive = 1; $isLive = 1;
$isEmbed = 1;
require_once '../../videos/configuration.php'; require_once '../../videos/configuration.php';
/** /**
* this was made to mask the main URL * this was made to mask the main URL
@ -33,7 +34,7 @@ if(!empty($objSecure)){
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <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> <title><?php echo $config->getWebSiteTitle(); ?> </title>
<link href="<?php echo $global['webSiteRootURL']; ?>bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css"/> <link href="<?php echo $global['webSiteRootURL']; ?>bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css"/>
@ -73,6 +74,10 @@ if(!empty($objSecure)){
} }
</style> </style>
<script>
var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>';
var player;
</script>
</head> </head>
<body style="background-color: black; overflow-x: hidden;"> <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" <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" class="embed-responsive-item video-js vjs-default-skin vjs-big-play-centered"
id="mainVideo" data-setup='{ "aspectRatio": "16:9", "techorder" : ["flash", "html5"] }'> 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> </video>
<?php <?php
if (AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) { if (AVideoPlugin::isEnabled("0e225f8e-15e2-43d4-8ff7-0cb07c2a2b3b")) {
@ -138,8 +143,8 @@ if(!empty($objSecure)){
</script> </script>
<script src="<?php echo $global['webSiteRootURL']; ?>js/video.js/video.min.js" type="text/javascript"></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']; ?>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']; ?>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> <script>
$(document).ready(function () { $(document).ready(function () {

View file

@ -1,6 +1,7 @@
<?php <?php
global $isLive; global $isLive;
$isLive = 1; $isLive = 1;
$isEmbed = 1;
$customizedAdvanced = AVideoPlugin::getObjectDataIfEnabled('CustomizeAdvanced'); $customizedAdvanced = AVideoPlugin::getObjectDataIfEnabled('CustomizeAdvanced');
$objSecure = AVideoPlugin::loadPluginIfEnabled('SecureVideosDirectory'); $objSecure = AVideoPlugin::loadPluginIfEnabled('SecureVideosDirectory');
@ -14,10 +15,10 @@ if (!empty($objSecure)) {
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <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> <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/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/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/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"/> <link href="<?php echo $global['webSiteRootURL']; ?>view/css/player.css" rel="stylesheet" type="text/css"/>
@ -37,6 +38,10 @@ if (!empty($objSecure)) {
} }
</style> </style>
<script>
var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>';
var player;
</script>
</head> </head>
<body> <body>
@ -63,8 +68,8 @@ if (!empty($objSecure)) {
echo AVideoPlugin::afterVideoJS(); 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']; ?>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/videojs-persistvolume/videojs.persistvolume.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/script.js" type="text/javascript"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {

View file

@ -96,8 +96,9 @@ abstract class PluginAbstract {
} }
public function getDataObject() { public function getDataObject() {
if (empty(PluginAbstract::$dataObject[$this->getUUID()])) { $uuid = $this->getUUID();
$obj = Plugin::getPluginByUUID($this->getUUID()); if (empty(PluginAbstract::$dataObject[$uuid])) {
$obj = Plugin::getPluginByUUID($uuid);
//echo $obj['object_data']; //echo $obj['object_data'];
$o = array(); $o = array();
if (!empty($obj['object_data'])) { if (!empty($obj['object_data'])) {

View file

@ -51,49 +51,23 @@ if(empty($obj)){
When registration approved by the admin, you will receive an email like this; <br> When registration approved by the admin, you will receive an email like this; <br>
<img src="../assets/images/activated.PNG"><br><br> <img src="../assets/images/activated.PNG"><br><br>
</li> </li>
<li>
Signin to view the indexing module/page <br>
<img src="../assets/images/signin.PNG"><br><br>
</li>
</ul> </ul>
</li> </li>
<li> <li>
<b>Encountering Error</b> <br><br> <b>Encountering Error</b> <br><br>
<ul> <ul>
<li> <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> <img src="../assets/images/email_already_registered.PNG"><br><br>
</li> </li>
</ul> </ul>
</li> </li>
<li> <li>
<b> Submitting index of your platform</b> <br><br> <b> Submitting index of your platfor</b> <br><br>
<ul> <ul>
<li> <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>
<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> </ul>
</li> </li>
</ol> </ol>

View file

@ -24,7 +24,7 @@ if(empty($obj)){
include $global['systemRootPath'] . 'view/include/navbar.php'; include $global['systemRootPath'] . 'view/include/navbar.php';
?> ?>
<div class="container-fluid"> <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> </div>
<?php <?php
include $global['systemRootPath'] . 'view/include/footer.php'; include $global['systemRootPath'] . 'view/include/footer.php';

View file

@ -214,14 +214,19 @@ $(document).ready(function () {
}, },
}; };
})(); })();
$('[data-toggle="popover"]').popover(); try {
$('[data-toggle="tooltip"]').tooltip({container: 'body'}); $('[data-toggle="popover"]').popover();
$('[data-toggle="tooltip"]').on('click', function () { $('[data-toggle="tooltip"]').tooltip({container: 'body'});
var t = this; $('[data-toggle="tooltip"]').on('click', function () {
setTimeout(function () { var t = this;
$(t).tooltip('hide'); setTimeout(function () {
}, 2000); $(t).tooltip('hide');
}); }, 2000);
});
} catch (e) {
}
$(".thumbsImage").on("mouseenter", function () { $(".thumbsImage").on("mouseenter", function () {
gifId = $(this).find(".thumbsGIF").attr('id'); gifId = $(this).find(".thumbsGIF").attr('id');
$(".thumbsGIF").fadeOut(); $(".thumbsGIF").fadeOut();
@ -321,9 +326,9 @@ $(document).ready(function () {
if (!response.error) { if (!response.error) {
swal("Congratulations!", "File created!", "success"); swal("Congratulations!", "File created!", "success");
} else { } else {
if(response.msg){ if (response.msg) {
swal("Sorry!", response.msg, "error"); swal("Sorry!", response.msg, "error");
}else{ } else {
swal("Sorry!", "File NOT created!", "error"); swal("Sorry!", "File NOT created!", "error");
} }
} }
@ -695,36 +700,45 @@ function alertHTMLText(title, text) {
}); });
} }
function tooglePlayerLoop(){ function tooglePlayerLoop() {
setPlayerLoop(!isPlayerLoop()); setPlayerLoop(!isPlayerLoop());
} }
function setPlayerLoop(loop){ function setPlayerLoop(loop) {
if(loop){ if (loop) {
console.log("Loop ON"); console.log("Loop ON");
player.loop(1); player.loop(1);
$(".loop-button").removeClass('loop-disabled-button'); $(".loop-button").removeClass('loop-disabled-button');
$(".loop-button, .loopButton").addClass('fa-spin'); $(".loop-button, .loopButton").addClass('fa-spin');
}else{ } else {
$(".loop-button").addClass('loop-disabled-button'); $(".loop-button").addClass('loop-disabled-button');
$(".loop-button, .loopButton").removeClass('fa-spin'); $(".loop-button, .loopButton").removeClass('fa-spin');
console.log("Loop OFF"); console.log("Loop OFF");
player.loop(0); player.loop(0);
} }
Cookies.set('playerLoop', loop, { Cookies.set('playerLoop', loop, {
path: '/', path: '/',
expires: 365 expires: 365
}); });
if(typeof setImageLoop === 'function'){ if (typeof setImageLoop === 'function') {
setImageLoop(); setImageLoop();
} }
} }
function isPlayerLoop(){ function isPlayerLoop() {
var loop = Cookies.get('playerLoop'); var loop = Cookies.get('playerLoop');
if(loop === "false"){ if (loop === "false") {
return false; return false;
}else{ } else {
return true; return true;
} }
} }
function isArray(what) {
return Object.prototype.toString.call(what) === '[object Array]';
}
function reloadVideoJS() {
var src = player.currentSources();
player.src(src);
}