From 5c52709d6c40d1b9a34ad33d7241ef9f6a5fe08d Mon Sep 17 00:00:00 2001
From: DanielnetoDotCom
Date: Fri, 3 Jul 2020 11:30:08 -0300
Subject: [PATCH] Getting ready for the Live Stream Multiple servers
---
.github/CODE_OF_CONDUCT.md | 152 +++----
.github/ISSUE_TEMPLATE/bug_report.md | 84 ++--
.github/ISSUE_TEMPLATE/feature_request.md | 40 +-
.../usage-questions-and-help.md | 28 +-
.github/SECURITY.md | 42 +-
.github/stale.yml | 34 +-
...hp_secret=c67774a4f0074307b2cecd63ea4b1b44 | 1 +
plugin/AVideoPlugin.php | 18 +-
.../CustomizeAdvanced/CustomizeAdvanced.php | 4 +-
.../autoHideNavbarInSeconds.js | 46 ++-
plugin/Live/Live.php | 384 ++++++++++++++++--
.../Live/Objects/LiveTransmitionHistory.php | 15 +-
plugin/Live/Objects/Live_servers.php | 181 +++++++++
plugin/Live/Objects/modelLive.mwb | Bin 0 -> 14661 bytes
plugin/Live/Objects/modelLive.mwb.bak | Bin 0 -> 14661 bytes
plugin/Live/getImage.php | 2 +-
plugin/Live/getRecordedFile.php | 26 ++
plugin/Live/index.php | 289 +++++++------
plugin/Live/install/install.sql | 23 ++
plugin/Live/install/updateV4.0.sql | 32 ++
plugin/Live/m3u8.php | 53 ++-
plugin/Live/on_publish.php | 1 +
plugin/Live/stats.json.php | 104 +----
plugin/Live/view/Live_servers/add.json.php | 34 ++
plugin/Live/view/Live_servers/delete.json.php | 20 +
plugin/Live/view/Live_servers/index.php | 29 ++
plugin/Live/view/Live_servers/index_body.php | 281 +++++++++++++
plugin/Live/view/Live_servers/index_head.php | 5 +
plugin/Live/view/Live_servers/list.json.php | 8 +
plugin/Live/view/editor.php | 50 +++
plugin/Live/view/liveVideo.php | 2 +-
.../Live/view/loopBGHLS/enc_5efe4da35485d.key | 1 +
plugin/Live/view/loopBGHLS/index.m3u8 | 10 +
plugin/Live/view/loopBGHLS/index.m3u8.php | 35 ++
plugin/Live/view/loopBGHLS/index.ts.php | 14 +
plugin/Live/view/loopBGHLS/res240/index.m3u8 | 10 +
.../Live/view/loopBGHLS/res240/index.m3u8.php | 4 +
plugin/Live/view/loopBGHLS/res240/index0.ts | Bin 0 -> 324304 bytes
plugin/Live/view/loopBGHLS/res240/index1.ts | Bin 0 -> 240080 bytes
plugin/Live/view/loopBGHLS/res360/index.m3u8 | 10 +
.../Live/view/loopBGHLS/res360/index.m3u8.php | 4 +
plugin/Live/view/loopBGHLS/res360/index0.ts | Bin 0 -> 807280 bytes
plugin/Live/view/loopBGHLS/res360/index1.ts | Bin 0 -> 145712 bytes
plugin/Live/view/loopBGHLS/res480/index.m3u8 | 10 +
.../Live/view/loopBGHLS/res480/index.m3u8.php | 4 +
plugin/Live/view/loopBGHLS/res480/index0.ts | Bin 0 -> 1202272 bytes
plugin/Live/view/loopBGHLS/res480/index1.ts | Bin 0 -> 214704 bytes
plugin/Live/view/loopBGHLS/res720/index.m3u8 | 10 +
.../Live/view/loopBGHLS/res720/index.m3u8.php | 4 +
plugin/Live/view/loopBGHLS/res720/index0.ts | Bin 0 -> 2042816 bytes
plugin/Live/view/loopBGHLS/res720/index1.ts | Bin 0 -> 357968 bytes
plugin/Live/view/menuRight.php | 152 ++++---
plugin/Live/view/onlineLabel.php | 110 ++++-
plugin/Live/view/videoEmbeded.php | 15 +-
plugin/Live/view/videoEmbededV2.php | 11 +-
plugin/LiveLinks/view/videoEmbeded.php | 11 +-
plugin/Plugin.abstract.php | 5 +-
plugin/WWBN/page/info.php | 32 +-
plugin/WWBN/page/wwbn_signup.php | 2 +-
view/js/script.js | 58 ++-
60 files changed, 1868 insertions(+), 632 deletions(-)
create mode 100644 objects/delete.json.php_secret=c67774a4f0074307b2cecd63ea4b1b44
create mode 100644 plugin/Live/Objects/Live_servers.php
create mode 100644 plugin/Live/Objects/modelLive.mwb
create mode 100644 plugin/Live/Objects/modelLive.mwb.bak
create mode 100644 plugin/Live/getRecordedFile.php
create mode 100644 plugin/Live/install/updateV4.0.sql
create mode 100644 plugin/Live/view/Live_servers/add.json.php
create mode 100644 plugin/Live/view/Live_servers/delete.json.php
create mode 100644 plugin/Live/view/Live_servers/index.php
create mode 100644 plugin/Live/view/Live_servers/index_body.php
create mode 100644 plugin/Live/view/Live_servers/index_head.php
create mode 100644 plugin/Live/view/Live_servers/list.json.php
create mode 100644 plugin/Live/view/editor.php
create mode 100644 plugin/Live/view/loopBGHLS/enc_5efe4da35485d.key
create mode 100644 plugin/Live/view/loopBGHLS/index.m3u8
create mode 100644 plugin/Live/view/loopBGHLS/index.m3u8.php
create mode 100644 plugin/Live/view/loopBGHLS/index.ts.php
create mode 100644 plugin/Live/view/loopBGHLS/res240/index.m3u8
create mode 100644 plugin/Live/view/loopBGHLS/res240/index.m3u8.php
create mode 100644 plugin/Live/view/loopBGHLS/res240/index0.ts
create mode 100644 plugin/Live/view/loopBGHLS/res240/index1.ts
create mode 100644 plugin/Live/view/loopBGHLS/res360/index.m3u8
create mode 100644 plugin/Live/view/loopBGHLS/res360/index.m3u8.php
create mode 100644 plugin/Live/view/loopBGHLS/res360/index0.ts
create mode 100644 plugin/Live/view/loopBGHLS/res360/index1.ts
create mode 100644 plugin/Live/view/loopBGHLS/res480/index.m3u8
create mode 100644 plugin/Live/view/loopBGHLS/res480/index.m3u8.php
create mode 100644 plugin/Live/view/loopBGHLS/res480/index0.ts
create mode 100644 plugin/Live/view/loopBGHLS/res480/index1.ts
create mode 100644 plugin/Live/view/loopBGHLS/res720/index.m3u8
create mode 100644 plugin/Live/view/loopBGHLS/res720/index.m3u8.php
create mode 100644 plugin/Live/view/loopBGHLS/res720/index0.ts
create mode 100644 plugin/Live/view/loopBGHLS/res720/index1.ts
diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md
index 059a4132b3..7de18023e3 100644
--- a/.github/CODE_OF_CONDUCT.md
+++ b/.github/CODE_OF_CONDUCT.md
@@ -1,76 +1,76 @@
-# Contributor Covenant Code of Conduct
-
-## Our Pledge
-
-In the interest of fostering an open and welcoming environment, we as
-contributors and maintainers pledge to making participation in our project and
-our community a harassment-free experience for everyone, regardless of age, body
-size, disability, ethnicity, sex characteristics, gender identity and expression,
-level of experience, education, socio-economic status, nationality, personal
-appearance, race, religion, or sexual identity and orientation.
-
-## Our Standards
-
-Examples of behavior that contributes to creating a positive environment
-include:
-
-* Using welcoming and inclusive language
-* Being respectful of differing viewpoints and experiences
-* Gracefully accepting constructive criticism
-* Focusing on what is best for the community
-* Showing empathy towards other community members
-
-Examples of unacceptable behavior by participants include:
-
-* The use of sexualized language or imagery and unwelcome sexual attention or
- advances
-* Trolling, insulting/derogatory comments, and personal or political attacks
-* Public or private harassment
-* Publishing others' private information, such as a physical or electronic
- address, without explicit permission
-* Other conduct which could reasonably be considered inappropriate in a
- professional setting
-
-## Our Responsibilities
-
-Project maintainers are responsible for clarifying the standards of acceptable
-behavior and are expected to take appropriate and fair corrective action in
-response to any instances of unacceptable behavior.
-
-Project maintainers have the right and responsibility to remove, edit, or
-reject comments, commits, code, wiki edits, issues, and other contributions
-that are not aligned to this Code of Conduct, or to ban temporarily or
-permanently any contributor for other behaviors that they deem inappropriate,
-threatening, offensive, or harmful.
-
-## Scope
-
-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
-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
-representative at an online or offline event. Representation of a project may be
-further defined and clarified by project maintainers.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be
-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
-is deemed necessary and appropriate to the circumstances. The project team is
-obligated to maintain confidentiality with regard to the reporter of an incident.
-Further details of specific enforcement policies may be posted separately.
-
-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
-members of the project's leadership.
-
-## Attribution
-
-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
-
-[homepage]: https://www.contributor-covenant.org
-
-For answers to common questions about this code of conduct, see
-https://www.contributor-covenant.org/faq
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, sex characteristics, gender identity and expression,
+level of experience, education, socio-economic status, nationality, personal
+appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+ advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+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
+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
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+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
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+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
+members of the project's leadership.
+
+## Attribution
+
+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
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see
+https://www.contributor-covenant.org/faq
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index ae2fa56236..b0414f3810 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -1,42 +1,42 @@
----
-name: Bug report
-about: Create a report to help us improve
-title: ''
-labels: bug
-assignees: ''
-
----
-
-**Describe the bug**
-A clear and concise description of what the bug is.
-
-**To Reproduce**
-Steps to reproduce the behavior:
-1. Go to '...'
-2. Click on '....'
-3. Scroll down to '....'
-4. See error
-
-**Expected behavior**
-A clear and concise description of what you expected to happen.
-
-**Error Logs**
-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
-
-**Screenshots**
-If applicable, add screenshots to help explain your problem.
-
-**Desktop (please complete the following information):**
- - OS: [e.g. iOS]
- - Browser [e.g. chrome, safari]
- - Version [e.g. 22]
-
-**Smartphone (please complete the following information):**
- - Device: [e.g. iPhone6]
- - OS: [e.g. iOS8.1]
- - Browser [e.g. stock browser, safari]
- - Version [e.g. 22]
-
-**Additional context**
-Add any other context about the problem here.
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: bug
+assignees: ''
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**To Reproduce**
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Error Logs**
+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
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Desktop (please complete the following information):**
+ - OS: [e.g. iOS]
+ - Browser [e.g. chrome, safari]
+ - Version [e.g. 22]
+
+**Smartphone (please complete the following information):**
+ - Device: [e.g. iPhone6]
+ - OS: [e.g. iOS8.1]
+ - Browser [e.g. stock browser, safari]
+ - Version [e.g. 22]
+
+**Additional context**
+Add any other context about the problem here.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
index 11fc491ef1..73987eda9e 100644
--- a/.github/ISSUE_TEMPLATE/feature_request.md
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -1,20 +1,20 @@
----
-name: Feature request
-about: Suggest an idea for this project
-title: ''
-labels: enhancement
-assignees: ''
-
----
-
-**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 [...]
-
-**Describe the solution you'd like**
-A clear and concise description of what you want to happen.
-
-**Describe alternatives you've considered**
-A clear and concise description of any alternative solutions or features you've considered.
-
-**Additional context**
-Add any other context or screenshots about the feature request here.
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ''
+labels: enhancement
+assignees: ''
+
+---
+
+**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 [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
diff --git a/.github/ISSUE_TEMPLATE/usage-questions-and-help.md b/.github/ISSUE_TEMPLATE/usage-questions-and-help.md
index ea70921d86..740a5c2c76 100644
--- a/.github/ISSUE_TEMPLATE/usage-questions-and-help.md
+++ b/.github/ISSUE_TEMPLATE/usage-questions-and-help.md
@@ -1,14 +1,14 @@
----
-name: Usage Questions and Help
-about: Feel free to make your usage question here.
-title: ''
-labels: question
-assignees: ''
-
----
-
-**Describe the question**
-A clear and concise description of what is your question.
-
-**Screenshots**
-Provide some screenshots to help us understand and explain your problem.
+---
+name: Usage Questions and Help
+about: Feel free to make your usage question here.
+title: ''
+labels: question
+assignees: ''
+
+---
+
+**Describe the question**
+A clear and concise description of what is your question.
+
+**Screenshots**
+Provide some screenshots to help us understand and explain your problem.
diff --git a/.github/SECURITY.md b/.github/SECURITY.md
index af48df1ac5..146a4fd7c5 100644
--- a/.github/SECURITY.md
+++ b/.github/SECURITY.md
@@ -1,21 +1,21 @@
-# Security Policy
-
-## Supported Versions
-
-Use this section to tell people about which versions of your project are
-currently being supported with security updates.
-
-| Version | Supported |
-| ------- | ------------------ |
-| 5.1.x | :white_check_mark: |
-| 5.0.x | :x: |
-| 4.0.x | :white_check_mark: |
-| < 4.0 | :x: |
-
-## Reporting 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
-reported vulnerability, what to expect if the vulnerability is accepted or
-declined, etc.
+# Security Policy
+
+## Supported Versions
+
+Use this section to tell people about which versions of your project are
+currently being supported with security updates.
+
+| Version | Supported |
+| ------- | ------------------ |
+| 5.1.x | :white_check_mark: |
+| 5.0.x | :x: |
+| 4.0.x | :white_check_mark: |
+| < 4.0 | :x: |
+
+## Reporting 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
+reported vulnerability, what to expect if the vulnerability is accepted or
+declined, etc.
diff --git a/.github/stale.yml b/.github/stale.yml
index e127e6d821..8bc9b21d4d 100644
--- a/.github/stale.yml
+++ b/.github/stale.yml
@@ -1,17 +1,17 @@
-# Number of days of inactivity before an issue becomes stale
-daysUntilStale: 30
-# Number of days of inactivity before a stale issue is closed
-daysUntilClose: 3
-# Issues with these labels will never be considered stale
-exemptLabels:
- - pinned
- - security
-# Label to use when marking an issue as stale
-staleLabel: wontfix
-# Comment to post when marking an issue as stale. Set to `false` to disable
-markComment: >
- 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
- for your contributions.
-# Comment to post when closing a stale issue. Set to `false` to disable
-closeComment: false
+# Number of days of inactivity before an issue becomes stale
+daysUntilStale: 30
+# Number of days of inactivity before a stale issue is closed
+daysUntilClose: 3
+# Issues with these labels will never be considered stale
+exemptLabels:
+ - pinned
+ - security
+# Label to use when marking an issue as stale
+staleLabel: wontfix
+# Comment to post when marking an issue as stale. Set to `false` to disable
+markComment: >
+ 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
+ for your contributions.
+# Comment to post when closing a stale issue. Set to `false` to disable
+closeComment: false
diff --git a/objects/delete.json.php_secret=c67774a4f0074307b2cecd63ea4b1b44 b/objects/delete.json.php_secret=c67774a4f0074307b2cecd63ea4b1b44
new file mode 100644
index 0000000000..daa9a4ed34
--- /dev/null
+++ b/objects/delete.json.php_secret=c67774a4f0074307b2cecd63ea4b1b44
@@ -0,0 +1 @@
+{"error":true,"msg":"Empty filename","aVideoStorageURL":"http:\/\/ubuntu.gdrive.local\/YouPHPTube-Storage\/","filename":""}
\ No newline at end of file
diff --git a/plugin/AVideoPlugin.php b/plugin/AVideoPlugin.php
index b9ccd9d4ae..b70a085ba6 100644
--- a/plugin/AVideoPlugin.php
+++ b/plugin/AVideoPlugin.php
@@ -325,14 +325,30 @@ class AVideoPlugin {
}
static function getObjectData($name) {
+ return self::getDataObject($name);
+ }
+
+ static function getDataObject($name) {
+ global $pluginGetDataObject;
+ if(!isset($pluginGetDataObject)){
+ $pluginGetDataObject = array();
+ }
+ if(!empty($pluginGetDataObject[$name])){
+ return $pluginGetDataObject[$name];
+ }
$p = static::loadPlugin($name);
if ($p) {
- return $p->getDataObject();
+ $pluginGetDataObject[$name] = $p->getDataObject();
+ return $pluginGetDataObject[$name];
}
return false;
}
static function getObjectDataIfEnabled($name) {
+ return self::getDataObjectIfEnabled($name);
+ }
+
+ static function getDataObjectIfEnabled($name) {
$p = static::loadPlugin($name);
if ($p) {
$uuid = $p->getUUID();
diff --git a/plugin/CustomizeAdvanced/CustomizeAdvanced.php b/plugin/CustomizeAdvanced/CustomizeAdvanced.php
index d4072428b0..e6533c1802 100644
--- a/plugin/CustomizeAdvanced/CustomizeAdvanced.php
+++ b/plugin/CustomizeAdvanced/CustomizeAdvanced.php
@@ -204,10 +204,10 @@ class CustomizeAdvanced extends PluginAbstract {
if ($obj->disableNavBarInsideIframe) {
$content .= '';
}
- if ($obj->autoHideNavbar) {
+ if ($obj->autoHideNavbar && !isEmbed()) {
$content .= '';
}
- if ($obj->autoHideNavbarInSeconds) {
+ if ($obj->autoHideNavbarInSeconds && !isEmbed()) {
$content .= '
+
+
+
diff --git a/plugin/Live/install/install.sql b/plugin/Live/install/install.sql
index 5c21ad729c..a756c401d6 100644
--- a/plugin/Live/install/install.sql
+++ b/plugin/Live/install/install.sql
@@ -72,8 +72,10 @@ CREATE TABLE IF NOT EXISTS `live_transmitions_history` (
`created` DATETIME NULL,
`modified` DATETIME NULL,
`users_id` INT(11) NOT NULL,
+ `live_servers_id` INT(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
INDEX `fk_live_transmitions_history_users_idx` (`users_id` ASC),
+ INDEX `fk_live_transmitions_history_live_servers1_idx` (`live_servers_id` ASC),
CONSTRAINT `fk_live_transmitions_history_users`
FOREIGN KEY (`users_id`)
REFERENCES `users` (`id`)
@@ -97,6 +99,27 @@ CREATE TABLE IF NOT EXISTS `live_transmition_history_log` (
ON UPDATE NO ACTION)
ENGINE = InnoDB;
+CREATE TABLE IF NOT EXISTS `live_servers` (
+ `id` INT(11) NOT NULL AUTO_INCREMENT,
+ `name` VARCHAR(45) NULL DEFAULT NULL,
+ `url` VARCHAR(255) NULL,
+ `status` CHAR(1) NULL DEFAULT 'a',
+ `created` DATETIME NULL DEFAULT NULL,
+ `modified` DATETIME NULL DEFAULT NULL,
+ `rtmp_server` VARCHAR(255) NULL DEFAULT NULL,
+ `playerServer` VARCHAR(255) NULL DEFAULT NULL,
+ `stats_url` VARCHAR(255) NULL DEFAULT NULL,
+ `disableDVR` TINYINT(1) NULL DEFAULT NULL,
+ `disableGifThumbs` TINYINT(1) NULL DEFAULT NULL,
+ `useAadaptiveMode` TINYINT(1) NULL DEFAULT NULL,
+ `protectLive` TINYINT(1) NULL DEFAULT NULL,
+ `getRemoteFile` VARCHAR(255) NULL DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ INDEX `live_serversindex2` (`status` ASC),
+ INDEX `live_servers` (`url` ASC))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = utf8;
+
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
diff --git a/plugin/Live/install/updateV4.0.sql b/plugin/Live/install/updateV4.0.sql
new file mode 100644
index 0000000000..3bec181f36
--- /dev/null
+++ b/plugin/Live/install/updateV4.0.sql
@@ -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;
\ No newline at end of file
diff --git a/plugin/Live/m3u8.php b/plugin/Live/m3u8.php
index 180729fe34..fe3bccb7d6 100644
--- a/plugin/Live/m3u8.php
+++ b/plugin/Live/m3u8.php
@@ -1,7 +1,7 @@
playerServer;
- $_SESSION['useAadaptiveMode'] = $obj->useAadaptiveMode;
+ $_SESSION['playerServer'][$live_servers_id] = Live::getPlayerServer();
+ $_SESSION['useAadaptiveMode'][$live_servers_id] = Live::getUseAadaptiveMode();
} else {
@$global['mysqli']->close();
}
-if ($_SESSION['useAadaptiveMode']) {
- $complement = $_SESSION['playerServer'] . "/";
- $url = $_SESSION['playerServer'] . "/{$uuid}.m3u8";
+if ($_SESSION['useAadaptiveMode'][$live_servers_id]) {
+ $complement = $_SESSION['playerServer'][$live_servers_id] . "/";
+ $url = $_SESSION['playerServer'][$live_servers_id] . "/{$uuid}.m3u8";
$content = url_get_contents($url);
}
-
if (empty($content)) {
- $complement = $_SESSION['playerServer'] . "/{$uuid}/";
- $url = $_SESSION['playerServer'] . "/{$uuid}/index.m3u8";
+ $complement = $_SESSION['playerServer'][$live_servers_id] . "/{$uuid}/";
+ $url = $_SESSION['playerServer'][$live_servers_id] . "/{$uuid}/index.m3u8";
$content = url_get_contents($url);
+ if (!empty($content)) {
+ _session_start();
+ $_SESSION['useAadaptiveMode'][$live_servers_id] = 0;
+ }
+}
+if (empty($_SESSION['useAadaptiveMode'][$live_servers_id]) && empty($content)) {
+ $complement = $_SESSION['playerServer'][$live_servers_id] . "/";
+ $url = $_SESSION['playerServer'][$live_servers_id] . "/{$uuid}.m3u8";
+ $content = url_get_contents($url);
+ if (!empty($content)) {
+ _session_start();
+ $_SESSION['useAadaptiveMode'][$live_servers_id] = 1;
+ }
+}
+
+if(empty($content)){ // get the default loop
+ //$complement = "{$global['webSiteRootURL']}plugin/Live/view/loopBGHLS/";
+ //$content = file_get_contents("{$global['systemRootPath']}plugin/Live/view/loopBGHLS/index.m3u8");
+ include "{$global['systemRootPath']}plugin/Live/view/loopBGHLS/index.m3u8.php";
+ exit;
}
if (empty($_SESSION['m3u8Verified'])) {
@@ -57,7 +88,7 @@ if (empty($_SESSION['m3u8Verified'])) {
}
$lines = preg_split("/((\r?\n)|(\r\n?))/", $content);
for ($i = 0; $i < count($lines); $i++) {
- if (preg_match('/.*\.(m3u8|ts)$/i', $lines[$i])) {
+ if (preg_match('/.*\.(m3u8|ts|key)$/i', $lines[$i])) {
echo $complement;
}
echo $lines[$i] . PHP_EOL;
diff --git a/plugin/Live/on_publish.php b/plugin/Live/on_publish.php
index e982377b13..a8557ae83d 100644
--- a/plugin/Live/on_publish.php
+++ b/plugin/Live/on_publish.php
@@ -56,6 +56,7 @@ if (!empty($_GET['p'])) {
$lth->setDescription($obj->row['description']);
$lth->setKey($_POST['name']);
$lth->setUsers_id($user->getBdId());
+ $lth->setLive_servers_id(Live_servers::getServerIdFromRTMPHost($url));
_error_log("NGINX ON Publish saving LiveTransmitionHistory");
$lth->save();
_error_log("NGINX ON Publish saved LiveTransmitionHistory");
diff --git a/plugin/Live/stats.json.php b/plugin/Live/stats.json.php
index 819786886c..f021c1506f 100644
--- a/plugin/Live/stats.json.php
+++ b/plugin/Live/stats.json.php
@@ -1,98 +1,20 @@
error = true;
-$obj->msg = "OFFLINE";
-$obj->nclients = 0;
-if(empty($_POST['name']) && !empty($_GET['name'])){
- $_POST['name'] = $_GET['name'];
-}else if(empty($_POST['name'])){
- $_POST['name'] = "undefined";
+session_write_close();
+$pobj = AVideoPlugin::getDataObjectIfEnabled("Live");
+
+if (empty($pobj)) {
+ die(json_encode("Plugin disabled"));
}
-$obj->name = $_POST['name'];
-$obj->applications = array();
-$_GET['lifetime'] = "10";
-if(empty($p)){
- die(json_encode($obj));
+$live_servers_id = Live::getCurrentLiveServersId();
+$cacheName = "statsCache_{$live_servers_id}_".md5($global['systemRootPath']);
+$json = ObjectYPT::getCache($cacheName, $pobj->cacheStatsTimout);
+if(empty($json)){
+ $json = json_encode(Live::getStats());
+ ObjectYPT::setCache($cacheName, $json);
}
-$xml = $p->getStatsObject();
-$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';
+echo $json;
\ No newline at end of file
diff --git a/plugin/Live/view/Live_servers/add.json.php b/plugin/Live/view/Live_servers/add.json.php
new file mode 100644
index 0000000000..12e3f36898
--- /dev/null
+++ b/plugin/Live/view/Live_servers/add.json.php
@@ -0,0 +1,34 @@
+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);
diff --git a/plugin/Live/view/Live_servers/delete.json.php b/plugin/Live/view/Live_servers/delete.json.php
new file mode 100644
index 0000000000..9781368888
--- /dev/null
+++ b/plugin/Live/view/Live_servers/delete.json.php
@@ -0,0 +1,20 @@
+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));
+?>
\ No newline at end of file
diff --git a/plugin/Live/view/Live_servers/index.php b/plugin/Live/view/Live_servers/index.php
new file mode 100644
index 0000000000..38a972cef9
--- /dev/null
+++ b/plugin/Live/view/Live_servers/index.php
@@ -0,0 +1,29 @@
+
+
+
+
+
getWebSiteTitle(); ?> :: Live
+
+
+
+