mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
Add support for standalone FFMPEG restreaming configuration
- Introduced a new property `restreamStandAloneFFMPEG` in the Live plugin to allow configuration of standalone FFMPEG restreaming. - Updated the Live_restreams token verification process to include the `restreamStandAloneFFMPEG` value from the Live plugin data object.
This commit is contained in:
parent
45f839c8b6
commit
4324e883b5
4 changed files with 27 additions and 4797 deletions
|
@ -624,13 +624,17 @@ function cutVideoWithFFmpeg($inputFile, $startTimeInSeconds, $endTimeInSeconds,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function buildFFMPEGRemoteURL($actionParams, $callback='')
|
function buildFFMPEGRemoteURL($actionParams, $callback='', $standAloneFFMPEG='')
|
||||||
{
|
{
|
||||||
$obj = AVideoPlugin::getDataObjectIfEnabled('API');
|
$obj = AVideoPlugin::getDataObjectIfEnabled('API');
|
||||||
if (empty($obj) || empty($obj->standAloneFFMPEG)) {
|
if (empty($obj) || empty($obj->standAloneFFMPEG)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$url = "{$obj->standAloneFFMPEG}";
|
if(empty($standAloneFFMPEG)){
|
||||||
|
$url = $standAloneFFMPEG;
|
||||||
|
}else{
|
||||||
|
$url = "{$obj->standAloneFFMPEG}";
|
||||||
|
}
|
||||||
$actionParams['time'] = time();
|
$actionParams['time'] = time();
|
||||||
$actionParams['notifyCode'] = encryptString(time());
|
$actionParams['notifyCode'] = encryptString(time());
|
||||||
$actionParams['callback'] = encryptString($callback);
|
$actionParams['callback'] = encryptString($callback);
|
||||||
|
@ -640,9 +644,9 @@ function buildFFMPEGRemoteURL($actionParams, $callback='')
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
function execFFMPEGAsyncOrRemote($command, $keyword, $callback='')
|
function execFFMPEGAsyncOrRemote($command, $keyword, $callback='', $standAloneFFMPEG='')
|
||||||
{
|
{
|
||||||
$url = buildFFMPEGRemoteURL(['ffmpegCommand' => $command, 'keyword' => $keyword], $callback);
|
$url = buildFFMPEGRemoteURL(['ffmpegCommand' => $command, 'keyword' => $keyword], $callback, $standAloneFFMPEG);
|
||||||
if ($url) {
|
if ($url) {
|
||||||
_error_log("execFFMPEGAsyncOrRemote: URL $command");
|
_error_log("execFFMPEGAsyncOrRemote: URL $command");
|
||||||
_error_log("execFFMPEGAsyncOrRemote: URL $url");
|
_error_log("execFFMPEGAsyncOrRemote: URL $url");
|
||||||
|
@ -653,9 +657,9 @@ function execFFMPEGAsyncOrRemote($command, $keyword, $callback='')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFFMPEGRemoteLog($keyword)
|
function getFFMPEGRemoteLog($keyword, $standAloneFFMPEG='')
|
||||||
{
|
{
|
||||||
$url = buildFFMPEGRemoteURL(['log' => 1, 'keyword' => $keyword]);
|
$url = buildFFMPEGRemoteURL(['log' => 1, 'keyword' => $keyword], '', $standAloneFFMPEG);
|
||||||
//var_dump($url);
|
//var_dump($url);
|
||||||
if ($url) {
|
if ($url) {
|
||||||
_error_log("getFFMPEGRemoteLog: URL $url " . json_encode(debug_backtrace()));
|
_error_log("getFFMPEGRemoteLog: URL $url " . json_encode(debug_backtrace()));
|
||||||
|
@ -665,9 +669,9 @@ function getFFMPEGRemoteLog($keyword)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopFFMPEGRemote($keyword)
|
function stopFFMPEGRemote($keyword, $standAloneFFMPEG='')
|
||||||
{
|
{
|
||||||
$url = buildFFMPEGRemoteURL(['stop' => 1, 'keyword' => $keyword]);
|
$url = buildFFMPEGRemoteURL(['stop' => 1, 'keyword' => $keyword], '', $standAloneFFMPEG);
|
||||||
if ($url) {
|
if ($url) {
|
||||||
_error_log("stopFFMPEGRemote: URL $url");
|
_error_log("stopFFMPEGRemote: URL $url");
|
||||||
return json_decode(url_get_contents($url));
|
return json_decode(url_get_contents($url));
|
||||||
|
@ -676,9 +680,9 @@ function stopFFMPEGRemote($keyword)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function testFFMPEGRemote()
|
function testFFMPEGRemote($standAloneFFMPEG='')
|
||||||
{
|
{
|
||||||
$url = buildFFMPEGRemoteURL(['test' => 1, 'microtime' => microtime(true)]);
|
$url = buildFFMPEGRemoteURL(['test' => 1, 'microtime' => microtime(true)], '', $standAloneFFMPEG);
|
||||||
if ($url) {
|
if ($url) {
|
||||||
_error_log("testFFMPEGRemote: URL $url");
|
_error_log("testFFMPEGRemote: URL $url");
|
||||||
return json_decode(url_get_contents($url));
|
return json_decode(url_get_contents($url));
|
||||||
|
@ -687,9 +691,9 @@ function testFFMPEGRemote()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function listFFMPEGRemote($keyword = '')
|
function listFFMPEGRemote($keyword = '', $standAloneFFMPEG='')
|
||||||
{
|
{
|
||||||
$url = buildFFMPEGRemoteURL(['list' => 1, 'keyword' => $keyword, 'microtime' => microtime(true)]);
|
$url = buildFFMPEGRemoteURL(['list' => 1, 'keyword' => $keyword, 'microtime' => microtime(true)], '', $standAloneFFMPEG);
|
||||||
if ($url) {
|
if ($url) {
|
||||||
_error_log("listFFMPEGRemote: URL $url");
|
_error_log("listFFMPEGRemote: URL $url");
|
||||||
return json_decode(url_get_contents($url));
|
return json_decode(url_get_contents($url));
|
||||||
|
@ -698,9 +702,9 @@ function listFFMPEGRemote($keyword = '')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function killFFMPEGRemote($pid)
|
function killFFMPEGRemote($pid, $standAloneFFMPEG='')
|
||||||
{
|
{
|
||||||
$url = buildFFMPEGRemoteURL(['kill' => $pid, 'microtime' => microtime(true)]);
|
$url = buildFFMPEGRemoteURL(['kill' => $pid, 'microtime' => microtime(true)], '', $standAloneFFMPEG);
|
||||||
if ($url) {
|
if ($url) {
|
||||||
_error_log("killFFMPEGRemote: URL $url");
|
_error_log("killFFMPEGRemote: URL $url");
|
||||||
return json_decode(url_get_contents($url));
|
return json_decode(url_get_contents($url));
|
||||||
|
@ -709,7 +713,7 @@ function killFFMPEGRemote($pid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isKeywordRunningFFMPEGRemote($keyword)
|
function isKeywordRunningFFMPEGRemote($keyword, $standAloneFFMPEG='')
|
||||||
{
|
{
|
||||||
$url = buildFFMPEGRemoteURL(['isKeywordRunning' => $keyword, 'microtime' => microtime(true)]);
|
$url = buildFFMPEGRemoteURL(['isKeywordRunning' => $keyword, 'microtime' => microtime(true)]);
|
||||||
if ($url) {
|
if ($url) {
|
||||||
|
@ -720,9 +724,9 @@ function isKeywordRunningFFMPEGRemote($keyword)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteFolderFFMPEGRemote($videoFilename)
|
function deleteFolderFFMPEGRemote($videoFilename, $standAloneFFMPEG='')
|
||||||
{
|
{
|
||||||
$url = buildFFMPEGRemoteURL(['deleteFolder' => $videoFilename]);
|
$url = buildFFMPEGRemoteURL(['deleteFolder' => $videoFilename], '', $standAloneFFMPEG);
|
||||||
if ($url) {
|
if ($url) {
|
||||||
_error_log("deleteFolderFFMPEGRemote: URL $url");
|
_error_log("deleteFolderFFMPEGRemote: URL $url");
|
||||||
return json_decode(url_get_contents($url));
|
return json_decode(url_get_contents($url));
|
||||||
|
@ -731,9 +735,9 @@ function deleteFolderFFMPEGRemote($videoFilename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteFileFFMPEGRemote($filePath)
|
function deleteFileFFMPEGRemote($filePath, $standAloneFFMPEG='')
|
||||||
{
|
{
|
||||||
$url = buildFFMPEGRemoteURL(['deleteFile' => $filePath]);
|
$url = buildFFMPEGRemoteURL(['deleteFile' => $filePath], '', $standAloneFFMPEG);
|
||||||
if ($url) {
|
if ($url) {
|
||||||
_error_log("deleteFileFFMPEGRemote: URL $url");
|
_error_log("deleteFileFFMPEGRemote: URL $url");
|
||||||
return json_decode(url_get_contents($url));
|
return json_decode(url_get_contents($url));
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -508,6 +508,7 @@ class Live extends PluginAbstract
|
||||||
$o->value = self::CAN_RESTREAM_All_USERS;
|
$o->value = self::CAN_RESTREAM_All_USERS;
|
||||||
$obj->whoCanRestream = $o;
|
$obj->whoCanRestream = $o;
|
||||||
self::addDataObjectHelper('whoCanRestream', 'Who can Restream');
|
self::addDataObjectHelper('whoCanRestream', 'Who can Restream');
|
||||||
|
$obj->restreamStandAloneFFMPEG = '';
|
||||||
|
|
||||||
$obj->disableDVR = false;
|
$obj->disableDVR = false;
|
||||||
self::addDataObjectHelper('disableDVR', 'Disable DVR', 'Enable or disable the DVR Feature, you can control the DVR length in your nginx.conf on the parameter hls_playlist_length');
|
self::addDataObjectHelper('disableDVR', 'Disable DVR', 'Enable or disable the DVR Feature, you can control the DVR length in your nginx.conf on the parameter hls_playlist_length');
|
||||||
|
|
|
@ -16,6 +16,7 @@ if (empty($_REQUEST['token'])) {
|
||||||
forbiddenPage('Token is empty');
|
forbiddenPage('Token is empty');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$liveObj = AVideoPlugin::getDataObject('Live');
|
||||||
|
|
||||||
$token = Live_restreams_logs::verifyToken($_REQUEST['token']);
|
$token = Live_restreams_logs::verifyToken($_REQUEST['token']);
|
||||||
|
|
||||||
|
@ -44,8 +45,9 @@ $obj->users_id = $lr->getUsers_id();
|
||||||
$obj->restreamsDestinations = array($obj->live_restreams_id=>$lr->getName());
|
$obj->restreamsDestinations = array($obj->live_restreams_id=>$lr->getName());
|
||||||
$obj->restreamsToken = array($obj->live_restreams_id=>encryptString($obj->live_restreams_id));
|
$obj->restreamsToken = array($obj->live_restreams_id=>encryptString($obj->live_restreams_id));
|
||||||
$obj->m3u8 = Live::getM3U8File($lhistory->getKey(), true, true);
|
$obj->m3u8 = Live::getM3U8File($lhistory->getKey(), true, true);
|
||||||
$obj->token = encryptString(array('users_id' => $obj->users_id, 'time' => time(), 'liveTransmitionHistory_id' => $obj->liveTransmitionHistory_id, 'live_restreams_id' => $obj->live_restreams_id));
|
$obj->token = encryptString(array('users_id' => $obj->users_id, 'time' => time(), 'liveTransmitionHistory_id' => $obj->liveTransmitionHistory_id, 'live_restreams_id' => $obj->live_restreams_id));
|
||||||
$obj->responseToken = $obj->token;
|
$obj->responseToken = $obj->token;
|
||||||
|
$obj->restreamStandAloneFFMPEG = $liveObj->restreamStandAloneFFMPEG ;
|
||||||
|
|
||||||
switch ($token->action) {
|
switch ($token->action) {
|
||||||
case 'log':
|
case 'log':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue