mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 10:49:36 +02:00
Improving meet support
This commit is contained in:
parent
df8772536d
commit
2ff18e3be1
16 changed files with 329 additions and 152 deletions
|
@ -147,6 +147,31 @@ class Live extends PluginAbstract {
|
||||||
return $o->key;
|
return $o->key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function getDestinationApplicationName() {
|
||||||
|
$server = self::getPlayerServer();
|
||||||
|
$server = rtrim($server, "/");
|
||||||
|
$parts = explode("/", $server);
|
||||||
|
$app = array_pop($parts);
|
||||||
|
$domain = self::getControl();
|
||||||
|
//return "{$domain}/control/drop/publisher?app={$app}&name={$key}";
|
||||||
|
return "{$app}?p=".User::getUserPass();
|
||||||
|
}
|
||||||
|
|
||||||
|
static function getDestinationHost() {
|
||||||
|
$server = self::getServer();
|
||||||
|
$host = parse_url($server, PHP_URL_HOST);
|
||||||
|
return $host;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function getDestinationPort() {
|
||||||
|
$server = self::getServer();
|
||||||
|
$port = parse_url($server, PHP_URL_PORT);
|
||||||
|
if(empty($port)){
|
||||||
|
$port = 1935;
|
||||||
|
}
|
||||||
|
return $port;
|
||||||
|
}
|
||||||
|
|
||||||
static function getServer($live_servers_id = -1) {
|
static function getServer($live_servers_id = -1) {
|
||||||
$obj = AVideoPlugin::getObjectData("Live");
|
$obj = AVideoPlugin::getObjectData("Live");
|
||||||
if (!empty($obj->useLiveServers)) {
|
if (!empty($obj->useLiveServers)) {
|
||||||
|
@ -171,6 +196,16 @@ class Live extends PluginAbstract {
|
||||||
return "{$domain}?command=drop_publisher&app={$app}&name={$key}&token=" . getToken(60);
|
return "{$domain}?command=drop_publisher&app={$app}&name={$key}&token=" . getToken(60);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function getIsRecording($key) {
|
||||||
|
$server = self::getPlayerServer();
|
||||||
|
$server = rtrim($server, "/");
|
||||||
|
$parts = explode("/", $server);
|
||||||
|
$app = array_pop($parts);
|
||||||
|
$domain = self::getControl();
|
||||||
|
//return "{$domain}/control/drop/publisher?app={$app}&name={$key}";
|
||||||
|
return "{$domain}?command=is_recording&app={$app}&name={$key}&token=" . getToken(60);
|
||||||
|
}
|
||||||
|
|
||||||
static function getStartRecordURL($key) {
|
static function getStartRecordURL($key) {
|
||||||
$server = self::getPlayerServer();
|
$server = self::getPlayerServer();
|
||||||
$server = rtrim($server, "/");
|
$server = rtrim($server, "/");
|
||||||
|
@ -434,6 +469,11 @@ class Live extends PluginAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStatsObject($live_servers_id = 0) {
|
function getStatsObject($live_servers_id = 0) {
|
||||||
|
if (!function_exists('simplexml_load_file')) {
|
||||||
|
_error_log("Live::getStatsObject: You need to install the simplexml_load_file function to be able to see the Live stats", AVideoLog::$ERROR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
global $getStatsObject;
|
global $getStatsObject;
|
||||||
if (!empty($getStatsObject[$live_servers_id])) {
|
if (!empty($getStatsObject[$live_servers_id])) {
|
||||||
return $getStatsObject[$live_servers_id];
|
return $getStatsObject[$live_servers_id];
|
||||||
|
|
|
@ -87,7 +87,11 @@ switch ($obj->command) {
|
||||||
$obj->newkey = LiveTransmition::resetTransmitionKey($l->getUsers_id());
|
$obj->newkey = LiveTransmition::resetTransmitionKey($l->getUsers_id());
|
||||||
case "drop_publisher":
|
case "drop_publisher":
|
||||||
//http://server.com/control/drop/publisher|subscriber|client?srv=SRV&app=APP&name=NAME&addr=ADDR&clientid=CLIENTID
|
//http://server.com/control/drop/publisher|subscriber|client?srv=SRV&app=APP&name=NAME&addr=ADDR&clientid=CLIENTID
|
||||||
$obj->commandURL = Live::getDropURL($obj->key, $obj->live_servers_id);
|
$obj->commandURL = Live::getDropURL($obj->key);
|
||||||
|
break;
|
||||||
|
case "is_recording":
|
||||||
|
//http://server.com/control/drop/publisher|subscriber|client?srv=SRV&app=APP&name=NAME&addr=ADDR&clientid=CLIENTID
|
||||||
|
$obj->commandURL = Live::getIsRecording($obj->key);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$obj->msg = "Command is invalid ($obj->command)";
|
$obj->msg = "Command is invalid ($obj->command)";
|
||||||
|
|
|
@ -32,15 +32,14 @@ $dropURL = "{$global['webSiteRootURL']}plugin/Live/droplive.json.php?live_transm
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script src="<?php echo $global['webSiteRootURL']; ?>plugin/Meet/external_api.js" type="text/javascript"></script>
|
|
||||||
<?php
|
<?php
|
||||||
include $global['systemRootPath'] . 'plugin/Meet/listener.js.php';
|
include $global['systemRootPath'] . 'plugin/Meet/api.js.php';
|
||||||
?>
|
?>
|
||||||
<span class=" pull-right" style="display: none;" id="meetButtons">
|
<span class=" pull-right" style="display: none;" id="meetButtons">
|
||||||
<button class="btn btn-danger btn-xs showOnLive hideOnProcessingLive hideOnMeetNotReady showOnLive hideOnNoLive" id="stopRecording" style="display: none;" onclick="stopRecording()" data-toggle="tooltip" data-placement="bottom" title="<?php echo __("Stop"); ?>">
|
<button class="btn btn-danger btn-xs showOnLive hideOnProcessingLive hideOnMeetNotReady showOnLive hideOnNoLive" id="stopRecording" style="display: none;" onclick="aVideoMeetStopRecording('<?php echo $dropURL; ?>')" data-toggle="tooltip" data-placement="bottom" title="<?php echo __("Stop"); ?>">
|
||||||
<i class="fas fa-stop"></i> <?php echo __("Stop"); ?>
|
<i class="fas fa-stop"></i> <?php echo __("Stop"); ?>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-success btn-xs showOnNoLive hideOnProcessingLive hideOnMeetNotReady" id="startRecording" style="display: none;" onclick="startRecording()" data-toggle="tooltip" data-placement="bottom" title="<?php echo __("Start Live Now"); ?>">
|
<button class="btn btn-success btn-xs showOnNoLive hideOnProcessingLive hideOnMeetNotReady" id="startRecording" style="display: none;" onclick="aVideoMeetStartRecording('<?php echo Live::getRTMPLink(); ?>','<?php echo $dropURL; ?>');" data-toggle="tooltip" data-placement="bottom" title="<?php echo __("Start Live Now"); ?>">
|
||||||
<i class="fas fa-circle"></i> <?php echo __("Go Live"); ?>
|
<i class="fas fa-circle"></i> <?php echo __("Go Live"); ?>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-warning btn-xs showOnProcessingLive hideOnMeetNotReady" style="display: none;">
|
<button class="btn btn-warning btn-xs showOnProcessingLive hideOnMeetNotReady" style="display: none;">
|
||||||
|
@ -85,7 +84,7 @@ include $global['systemRootPath'] . 'plugin/Meet/listener.js.php';
|
||||||
|
|
||||||
function event_on_meetReady() {
|
function event_on_meetReady() {
|
||||||
console.log("YPTMeetScript event_on_meetReady");
|
console.log("YPTMeetScript event_on_meetReady");
|
||||||
document.querySelector("iframe").contentWindow.postMessage({hideElement: ".watermark, .toolbox-button-wth-dialog"}, "*");
|
aVideoMeetHideElement(".watermark, .toolbox-button-wth-dialog")
|
||||||
meetIsReady = true;
|
meetIsReady = true;
|
||||||
showMeet();
|
showMeet();
|
||||||
on_meetReady();
|
on_meetReady();
|
||||||
|
@ -102,6 +101,11 @@ include $global['systemRootPath'] . 'plugin/Meet/listener.js.php';
|
||||||
on_live();
|
on_live();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function readyToClose() {
|
||||||
|
api.dispose();
|
||||||
|
hideMeet();
|
||||||
|
}
|
||||||
|
|
||||||
function startMeetNow() {
|
function startMeetNow() {
|
||||||
modal.showPleaseWait();
|
modal.showPleaseWait();
|
||||||
on_processingMeetReady();
|
on_processingMeetReady();
|
||||||
|
@ -116,39 +120,8 @@ include $global['systemRootPath'] . 'plugin/Meet/listener.js.php';
|
||||||
on_meetStop();
|
on_meetStop();
|
||||||
modal.hidePleaseWait();
|
modal.hidePleaseWait();
|
||||||
} else {
|
} else {
|
||||||
const domain = '<?php echo $domain; ?>';
|
aVideoMeetStart('<?php echo $domain; ?>', response.roomName, response.jwt, '<?php echo User::getEmail_(); ?>', '<?php echo User::getNameIdentification(); ?>', <?php echo json_encode(Meet::getButtons(0)); ?>);
|
||||||
const options = {
|
|
||||||
roomName: response.roomName,
|
|
||||||
jwt: response.jwt,
|
|
||||||
parentNode: document.querySelector('#divMeetToIFrame'),
|
|
||||||
userInfo: {
|
|
||||||
email: '<?php echo User::getEmail_(); ?>',
|
|
||||||
displayName: '<?php echo User::getNameIdentification(); ?>'
|
|
||||||
},
|
|
||||||
interfaceConfigOverwrite: {
|
|
||||||
TOOLBAR_BUTTONS: <?php echo json_encode(Meet::getButtons(0)); ?>,
|
|
||||||
//SET_FILMSTRIP_ENABLED: false,
|
|
||||||
//DISABLE_FOCUS_INDICATOR: true,
|
|
||||||
//DISABLE_DOMINANT_SPEAKER_INDICATOR: true,
|
|
||||||
//DISABLE_VIDEO_BACKGROUND: true,
|
|
||||||
DISABLE_JOIN_LEAVE_NOTIFICATIONS: true,
|
|
||||||
SHOW_JITSI_WATERMARK: false,
|
|
||||||
SHOW_BRAND_WATERMARK: false,
|
|
||||||
disableAudioLevels: true,
|
|
||||||
requireDisplayName: true,
|
|
||||||
enableLayerSuspension: true,
|
|
||||||
channelLastN: 4,
|
|
||||||
startVideoMuted: 10,
|
|
||||||
startAudioMuted: 10,
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
api = new JitsiMeetExternalAPI(domain, options);
|
|
||||||
|
|
||||||
api.addEventListeners({
|
|
||||||
readyToClose: readyToClose,
|
|
||||||
});
|
|
||||||
meetPassword = response.password;
|
meetPassword = response.password;
|
||||||
meetLink = response.link;
|
meetLink = response.link;
|
||||||
$('#meetLink').val(meetLink);
|
$('#meetLink').val(meetLink);
|
||||||
|
@ -158,11 +131,6 @@ include $global['systemRootPath'] . 'plugin/Meet/listener.js.php';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function readyToClose() {
|
|
||||||
api.dispose();
|
|
||||||
hideMeet();
|
|
||||||
}
|
|
||||||
|
|
||||||
var showStopStartInterval;
|
var showStopStartInterval;
|
||||||
function on_meetReady() {
|
function on_meetReady() {
|
||||||
modal.hidePleaseWait();
|
modal.hidePleaseWait();
|
||||||
|
@ -230,37 +198,6 @@ include $global['systemRootPath'] . 'plugin/Meet/listener.js.php';
|
||||||
$('#divMeetToIFrame').slideUp();
|
$('#divMeetToIFrame').slideUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
function startRecording() {
|
|
||||||
on_processingLive();
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo $dropURL; ?>',
|
|
||||||
success: function (response) {
|
|
||||||
console.log("YPTMeetScript Start Recording Drop");
|
|
||||||
console.log(response);
|
|
||||||
}
|
|
||||||
}).always(function (dataOrjqXHR, textStatus, jqXHRorErrorThrown) {
|
|
||||||
api.executeCommand('startRecording', {
|
|
||||||
mode: 'stream',
|
|
||||||
youtubeStreamKey: '<?php echo Live::getRTMPLink(); ?>',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function stopRecording() {
|
|
||||||
on_processingLive();
|
|
||||||
api.executeCommand('stopRecording', 'stream');
|
|
||||||
setTimeout(function () { // if I run the drop on the same time, the stopRecording fails
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo $dropURL; ?>',
|
|
||||||
success: function (response) {
|
|
||||||
console.log("YPTMeetScript Stop Recording Drop");
|
|
||||||
console.log(response);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, 5000);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
var setProcessingIsLiveTimeout;
|
var setProcessingIsLiveTimeout;
|
||||||
function setProcessingIsLive() {
|
function setProcessingIsLive() {
|
||||||
clearTimeout(setProcessingIsLiveTimeout);
|
clearTimeout(setProcessingIsLiveTimeout);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
$streamerURL = "https://demo.avideo.com/"; // change it to your streamer URL
|
$streamerURL = "https://demo.avideo.com/"; // change it to your streamer URL
|
||||||
|
$record_path = "/var/www/tmp/"; //update this URL
|
||||||
|
|
||||||
$server_name = "localhost";
|
$server_name = "localhost";
|
||||||
$port = "8080";
|
$port = "8080";
|
||||||
|
@ -108,6 +109,19 @@ switch ($obj->command) {
|
||||||
$obj->response = @file_get_contents($obj->requestedURL);
|
$obj->response = @file_get_contents($obj->requestedURL);
|
||||||
$obj->error = false;
|
$obj->error = false;
|
||||||
break;
|
break;
|
||||||
|
case "is_recording":
|
||||||
|
$tolerance = 10; // 10 seconds
|
||||||
|
$obj->response = false;
|
||||||
|
// check the last file change time, if is less then x seconds it is recording
|
||||||
|
$files = glob("$record_path/{$obj->name}*.flv");
|
||||||
|
foreach ($files as $value) {
|
||||||
|
if(time()<=filemtime($value)+$tolerance){
|
||||||
|
$obj->response = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$obj->error = false;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
getInputCopyToClipboard('server', Live::getServer() . "?p=" . User::getUserPass());
|
getInputCopyToClipboard('server', Live::getServer() . "?p=" . User::getUserPass());
|
||||||
?>
|
?>
|
||||||
<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>
|
<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>
|
||||||
|
<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 class="form-group">
|
<div class="form-group">
|
||||||
<label for="streamkey"><i class="fa fa-key"></i> <?php echo __("Stream name/key"); ?>:</label>
|
<label for="streamkey"><i class="fa fa-key"></i> <?php echo __("Stream name/key"); ?>:</label>
|
||||||
|
@ -20,12 +21,34 @@
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading"><i class="fas fa-hdd"></i> <?php echo __("Advanced"); ?></div>
|
||||||
|
<div class="panel-body" style="overflow: hidden;">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="serverAndStreamkey"><i class="fa fa-key"></i> <?php echo __("Server URL"); ?> + <?php echo __("Stream name/key"); ?>:</label>
|
<label for="serverAndStreamkey"><i class="fa fa-key"></i> <?php echo __("Server URL"); ?> + <?php echo __("Stream name/key"); ?>:</label>
|
||||||
<?php
|
<?php
|
||||||
getInputCopyToClipboard('serverAndStreamkey', Live::getServer() . "?p=" . User::getUserPass() . "/" . $trasnmition['key']);
|
getInputCopyToClipboard('serverAndStreamkey', Live::getServer() . "?p=" . User::getUserPass() . "/" . $trasnmition['key']);
|
||||||
?>
|
?>
|
||||||
<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 class="form-group">
|
||||||
|
<label for="destinationApplication"><i class="fa fa-cog"></i> <?php echo __("Destination Application Name"); ?>:</label>
|
||||||
|
<?php
|
||||||
|
getInputCopyToClipboard('destinationApplication', Live::getDestinationApplicationName());
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="destinationHost"><i class="fa fa-cog"></i> <?php echo __("Destination Host"); ?>:</label>
|
||||||
|
<?php
|
||||||
|
getInputCopyToClipboard('destinationHost', Live::getDestinationHost());
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="destinationPort"><i class="fas fa-door-open"></i> <?php echo __("Destination Port"); ?>:</label>
|
||||||
|
<?php
|
||||||
|
getInputCopyToClipboard('destinationPort', Live::getDestinationPort());
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -84,9 +84,9 @@ Passcode: {password}
|
||||||
"user" => $user,
|
"user" => $user,
|
||||||
"group" => $config->getWebSiteTitle()
|
"group" => $config->getWebSiteTitle()
|
||||||
],
|
],
|
||||||
"aud" => ($obj->server->value=='custom')?$obj->JWT_APP_ID:"avideo",
|
"aud" => ($obj->server->value == 'custom') ? $obj->JWT_APP_ID : "avideo",
|
||||||
//"iss" => "avideo",
|
//"iss" => "avideo",
|
||||||
"iss" => ($obj->server->value=='custom')?$obj->JWT_APP_ID:"*",
|
"iss" => ($obj->server->value == 'custom') ? $obj->JWT_APP_ID : "*",
|
||||||
"sub" => "meet.jitsi",
|
"sub" => "meet.jitsi",
|
||||||
"room" => $room,
|
"room" => $room,
|
||||||
"exp" => strtotime("+{$expirationInMinutes} min"),
|
"exp" => strtotime("+{$expirationInMinutes} min"),
|
||||||
|
@ -106,9 +106,9 @@ Passcode: {password}
|
||||||
|
|
||||||
static function getSecret() {
|
static function getSecret() {
|
||||||
$obj = AVideoPlugin::getDataObject("Meet");
|
$obj = AVideoPlugin::getDataObject("Meet");
|
||||||
if($obj->server->value=='custom'){
|
if ($obj->server->value == 'custom') {
|
||||||
return $obj->JWT_APP_SECRET;
|
return $obj->JWT_APP_SECRET;
|
||||||
}else{
|
} else {
|
||||||
return $obj->secret;
|
return $obj->secret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,19 +180,19 @@ Passcode: {password}
|
||||||
if (empty($json) || empty($json->host) || empty($json->isInstalled)) {
|
if (empty($json) || empty($json->host) || empty($json->isInstalled)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if($json->host=='custom'){
|
if ($json->host == 'custom') {
|
||||||
return "custom";
|
return "custom";
|
||||||
}
|
}
|
||||||
$obj = AVideoPlugin::getDataObject("Meet");
|
$obj = AVideoPlugin::getDataObject("Meet");
|
||||||
return "{$json->host}.{$obj->server->value}";
|
return "{$json->host}.{$obj->server->value}";
|
||||||
}
|
}
|
||||||
|
|
||||||
static function isCustomJitsi() {
|
static function isCustomJitsi() {
|
||||||
$json = self::getMeetServerStatus();
|
$json = self::getMeetServerStatus();
|
||||||
if (empty($json) || empty($json->host) || empty($json->isInstalled)) {
|
if (empty($json) || empty($json->host) || empty($json->isInstalled)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if($json->host=='custom'){
|
if ($json->host == 'custom') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -316,7 +316,18 @@ Passcode: {password}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static function getButtons($meet_schedule_id) {
|
static function getButtons($meet_schedule_id) {
|
||||||
|
/*
|
||||||
|
return [
|
||||||
|
'microphone', 'camera', 'closedcaptions', 'desktop', 'embedmeeting', 'fullscreen',
|
||||||
|
'fodeviceselection', 'hangup', 'profile', 'chat', 'recording',
|
||||||
|
'livestreaming', 'etherpad', 'sharedvideo', 'settings', 'raisehand',
|
||||||
|
'videoquality', 'filmstrip', 'invite', 'feedback', 'stats', 'shortcuts',
|
||||||
|
'tileview', 'videobackgroundblur', 'download', 'help', 'mute-everyone', 'security'
|
||||||
|
];
|
||||||
|
*
|
||||||
|
*/
|
||||||
if (self::isModerator($meet_schedule_id)) {
|
if (self::isModerator($meet_schedule_id)) {
|
||||||
if (self::hasJibris()) {
|
if (self::hasJibris()) {
|
||||||
return [
|
return [
|
||||||
|
@ -379,4 +390,33 @@ Passcode: {password}
|
||||||
return array("name" => $obj->server->type[$pObj->server->value], "domain" => $pObj->server->value);
|
return array("name" => $obj->server->type[$pObj->server->value], "domain" => $pObj->server->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function createJitsiButton($title, $svg, $onclick) {
|
||||||
|
global $global;
|
||||||
|
$id = "avideoMeet" . uniqid();
|
||||||
|
$svgContent = file_get_contents($global['systemRootPath'] . 'plugin/Meet/buttons/' . $svg);
|
||||||
|
$btn = '<div class="toolbox-button aVideoMeet" tabindex="0" role="button" onclick="' . $onclick . '" id="' . $id . '">'
|
||||||
|
. '<div class="tooltip" style="display:none; position: absolute; bottom: 60px;">' . $title . '</div>'
|
||||||
|
. '<div class="toolbox-icon">'
|
||||||
|
. '<div class="jitsi-icon">' . $svgContent . '</div>'
|
||||||
|
. '</div>'
|
||||||
|
. '</div>'
|
||||||
|
. '<script>'
|
||||||
|
. '$(function () {
|
||||||
|
$("#' . $id . '").on("mouseenter",
|
||||||
|
function () {
|
||||||
|
$(this).find(".tooltip").fadeIn();
|
||||||
|
});
|
||||||
|
$("#' . $id . '").on("mouseleave",
|
||||||
|
function () {
|
||||||
|
$(this).find(".tooltip").fadeOut();
|
||||||
|
});
|
||||||
|
});'
|
||||||
|
. '</script>';
|
||||||
|
return $btn;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function getJitsiMeetExternalAPI() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
159
plugin/Meet/api.js.php
Normal file
159
plugin/Meet/api.js.php
Normal file
|
@ -0,0 +1,159 @@
|
||||||
|
<?php
|
||||||
|
// this script will be executed on the AVideo side
|
||||||
|
$meetPlugin = AVideoPlugin::getDataObjectIfEnabled("Meet");
|
||||||
|
if (empty($meetPlugin)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$livePlugin = AVideoPlugin::getDataObjectIfEnabled("Live");
|
||||||
|
if (!empty($livePlugin) && User::canStream()) {
|
||||||
|
$trasnmition = LiveTransmition::createTransmitionIfNeed(User::getId());
|
||||||
|
$dropURL = "{$global['webSiteRootURL']}plugin/Live/droplive.json.php?live_transmition_id={$trasnmition['id']}&live_servers_id=" . Live::getCurrentLiveServersId();
|
||||||
|
$rtmpLink = Live::getRTMPLink();
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<script src="<?php echo $global['webSiteRootURL']; ?>plugin/Meet/external_api.js" type="text/javascript"></script>
|
||||||
|
<script>
|
||||||
|
var lastLiveStatus;
|
||||||
|
var eventMethod = window.addEventListener
|
||||||
|
? "addEventListener"
|
||||||
|
: "attachEvent";
|
||||||
|
var eventer = window[eventMethod];
|
||||||
|
var messageEvent = eventMethod === "attachEvent"
|
||||||
|
? "onmessage"
|
||||||
|
: "message";
|
||||||
|
eventer(messageEvent, function (e) {
|
||||||
|
if (typeof e.data.isLive !== 'undefined') {
|
||||||
|
if (lastLiveStatus !== e.data.isLive) {
|
||||||
|
lastLiveStatus = e.data.isLive;
|
||||||
|
console.log("YPTMeetScript live status changed");
|
||||||
|
if (lastLiveStatus) {
|
||||||
|
if (typeof event_on_live !== "undefined") {
|
||||||
|
event_on_live();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (typeof event_on_liveStop !== "undefined") {
|
||||||
|
event_on_liveStop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeof event_on_liveStatusChange !== "undefined") {
|
||||||
|
event_on_liveStatusChange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (typeof e.data.YPTisReady !== 'undefined') {
|
||||||
|
if (typeof event_on_meetReady !== "undefined") {
|
||||||
|
event_on_meetReady();
|
||||||
|
}
|
||||||
|
console.log("YPTMeetScript is loaded");
|
||||||
|
} else if (typeof e.data.conferenceIsReady !== 'undefined') {
|
||||||
|
if (typeof event_on_meetReady !== "undefined") {
|
||||||
|
event_on_meetReady();
|
||||||
|
}
|
||||||
|
console.log("YPTMeetScript conference is ready");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var api;
|
||||||
|
function aVideoMeetStart(domain, roomName, jwt, email, displayName, TOOLBAR_BUTTONS) {
|
||||||
|
const options = {
|
||||||
|
roomName: roomName,
|
||||||
|
jwt: jwt,
|
||||||
|
parentNode: document.querySelector('#meet'),
|
||||||
|
userInfo: {
|
||||||
|
email: email,
|
||||||
|
displayName: displayName
|
||||||
|
},
|
||||||
|
interfaceConfigOverwrite: {
|
||||||
|
TOOLBAR_BUTTONS: TOOLBAR_BUTTONS,
|
||||||
|
DISABLE_JOIN_LEAVE_NOTIFICATIONS: true,
|
||||||
|
disableAudioLevels: true,
|
||||||
|
requireDisplayName: true,
|
||||||
|
enableLayerSuspension: true,
|
||||||
|
channelLastN: 4,
|
||||||
|
startVideoMuted: 10,
|
||||||
|
startAudioMuted: 10,
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
api = new JitsiMeetExternalAPI(domain, options);
|
||||||
|
|
||||||
|
if (typeof readyToClose !== "undefined") {
|
||||||
|
api.addEventListeners({
|
||||||
|
readyToClose: readyToClose,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function aVideoMeetStartRecording(RTMPLink, dropURL) {
|
||||||
|
on_processingLive();
|
||||||
|
if (dropURL) {
|
||||||
|
$.ajax({
|
||||||
|
url: dropURL,
|
||||||
|
success: function (response) {
|
||||||
|
console.log("YPTMeetScript Start Recording Drop");
|
||||||
|
console.log(response);
|
||||||
|
}
|
||||||
|
}).always(function (dataOrjqXHR, textStatus, jqXHRorErrorThrown) {
|
||||||
|
api.executeCommand('startRecording', {
|
||||||
|
mode: 'stream',
|
||||||
|
youtubeStreamKey: RTMPLink,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
api.executeCommand('startRecording', {
|
||||||
|
mode: 'stream',
|
||||||
|
youtubeStreamKey: RTMPLink,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function aVideoMeetStopRecording(dropURL) {
|
||||||
|
on_processingLive();
|
||||||
|
api.executeCommand('stopRecording', 'stream');
|
||||||
|
if (dropURL) {
|
||||||
|
setTimeout(function () { // if I run the drop on the same time, the stopRecording fails
|
||||||
|
$.ajax({
|
||||||
|
url: dropURL,
|
||||||
|
success: function (response) {
|
||||||
|
console.log("YPTMeetScript Stop Recording Drop");
|
||||||
|
console.log(response);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function aVideoMeetConferenceIsReady() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function aVideoMeetHideElement(selectors) {
|
||||||
|
document.querySelector("iframe").contentWindow.postMessage({hideElement: selectors}, "*");
|
||||||
|
}
|
||||||
|
|
||||||
|
function aVideoMeetAppendElement(parentSelector, html) {
|
||||||
|
var append = {parentSelector: parentSelector, html: html};
|
||||||
|
document.querySelector("iframe").contentWindow.postMessage({append: append}, "*");
|
||||||
|
}
|
||||||
|
|
||||||
|
function aVideoMeetPrependElement(parentSelector, html) {
|
||||||
|
var prepend = {parentSelector: parentSelector, html: html};
|
||||||
|
document.querySelector("iframe").contentWindow.postMessage({prepend: prepend}, "*");
|
||||||
|
}
|
||||||
|
|
||||||
|
function aVideoMeetCreateButtons() {
|
||||||
|
<?php
|
||||||
|
if (!empty($rtmpLink)) {
|
||||||
|
?>
|
||||||
|
aVideoMeetAppendElement(".button-group-center", <?php echo json_encode(Meet::createJitsiButton(__("Go Live"),"startLive.svg", "alert(1)")); ?>);
|
||||||
|
//aVideoMeetAppendElement(".button-group-center", <?php //echo json_encode(Meet::createJitsiButton("startLive.svg", "aVideoMeetStartRecording('$rtmpLink','$dropURL')")); ?>);
|
||||||
|
//aVideoMeetAppendElement(".button-group-center", <?php //echo json_encode(Meet::createJitsiButton("stopLive.svg", "aVideoMeetStopRecording('$dropURL')")); ?>);
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
1
plugin/Meet/buttons/sample.svg
Normal file
1
plugin/Meet/buttons/sample.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg height="24" width="24" viewBox="0 0 32 32"><path d="M22.688 14l5.313-5.313v14.625l-5.313-5.313v4.688c0 .75-.625 1.313-1.375 1.313h-16C4.563 24 4 23.437 4 22.687V9.312c0-.75.563-1.313 1.313-1.313h16c.75 0 1.375.563 1.375 1.313V14z"></path></svg>
|
After Width: | Height: | Size: 249 B |
1
plugin/Meet/buttons/startLive.svg
Normal file
1
plugin/Meet/buttons/startLive.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg height="24" width="24" viewBox="0 0 24 24"><path d="M17.906 17.391A7.912 7.912 0 0020.015 12a7.983 7.983 0 00-5.016-7.406v.422c0 1.078-.938 1.969-2.016 1.969h-1.969v2.016c0 .563-.469.984-1.031.984H8.014v2.016h6a.96.96 0 01.984.984v3h.984c.891 0 1.641.609 1.922 1.406zm-6.89 2.531V18C9.938 18 9 17.062 9 15.984V15l-4.781-4.781A7.404 7.404 0 003.985 12c0 4.078 3.094 7.453 7.031 7.922zM12 2.016c5.531 0 9.984 4.453 9.984 9.984S17.531 21.984 12 21.984 2.016 17.531 2.016 12 6.469 2.016 12 2.016z"></path></svg>
|
After Width: | Height: | Size: 512 B |
1
plugin/Meet/buttons/startRec.svg
Normal file
1
plugin/Meet/buttons/startRec.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg height="24" width="24" viewBox="0 0 32 32"><path d="M22.667 16a6.667 6.667 0 11-13.334 0 6.667 6.667 0 0113.334 0z"></path><path d="M16 24a8 8 0 000-16 8 8 0 000 16zm0 1.333a9.333 9.333 0 110-18.666 9.333 9.333 0 110 18.666z"></path></svg>
|
After Width: | Height: | Size: 244 B |
4
plugin/Meet/buttons/stopLive.svg
Normal file
4
plugin/Meet/buttons/stopLive.svg
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="28" viewBox="0 0 24 28">
|
||||||
|
<title>stop</title>
|
||||||
|
<path d="M24 3v22c0 0.547-0.453 1-1 1h-22c-0.547 0-1-0.453-1-1v-22c0-0.547 0.453-1 1-1h22c0.547 0 1 0.453 1 1z"></path>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 247 B |
4
plugin/Meet/buttons/stopRec.svg
Normal file
4
plugin/Meet/buttons/stopRec.svg
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="28" viewBox="0 0 24 28">
|
||||||
|
<title>stop</title>
|
||||||
|
<path d="M24 3v22c0 0.547-0.453 1-1 1h-22c-0.547 0-1-0.453-1-1v-22c0-0.547 0.453-1 1-1h22c0.547 0 1 0.453 1 1z"></path>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 247 B |
|
@ -61,10 +61,10 @@ if (Meet::isModerator($meet_schedule_id)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($meetDomain=='custom'){
|
if ($meetDomain == 'custom') {
|
||||||
$domain = $objM->CUSTOM_JITSI_DOMAIN;
|
$domain = $objM->CUSTOM_JITSI_DOMAIN;
|
||||||
}else{
|
} else {
|
||||||
$domain = "{$meetDomain}?getRTMPLink=".urlencode(Live::getRTMPLink());
|
$domain = "{$meetDomain}?getRTMPLink=" . urlencode(Live::getRTMPLink());
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
$obj->link = Meet::getMeetRoomLink($_GET['roomName']);
|
$obj->link = Meet::getMeetRoomLink($_GET['roomName']);
|
||||||
|
@ -85,7 +85,6 @@ if($meetDomain=='custom'){
|
||||||
<meta name="msapplication-TileImage" content="<?php echo $config->getFavicon(true); ?>">
|
<meta name="msapplication-TileImage" content="<?php echo $config->getFavicon(true); ?>">
|
||||||
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/jquery-3.5.1.min.js"></script>
|
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/jquery-3.5.1.min.js"></script>
|
||||||
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/script.js"></script>
|
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/script.js"></script>
|
||||||
<script src="<?php echo $global['webSiteRootURL']; ?>plugin/Meet/external_api.js" type="text/javascript"></script>
|
|
||||||
<script>
|
<script>
|
||||||
var getRTMPLink = '<?php echo Live::getRTMPLink(); ?>';
|
var getRTMPLink = '<?php echo Live::getRTMPLink(); ?>';
|
||||||
</script>
|
</script>
|
||||||
|
@ -132,47 +131,22 @@ if($meetDomain=='custom'){
|
||||||
background: #000;
|
background: #000;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<?php
|
||||||
|
include $global['systemRootPath'] . 'plugin/Meet/api.js.php';
|
||||||
|
?>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="meet"></div>
|
<div id="meet"></div>
|
||||||
<script>
|
<script>
|
||||||
const domain = '<?php echo $domain; ?>';
|
aVideoMeetStart('<?php echo $domain; ?>', '<?php echo $meet->getName(); ?>', '<?php echo Meet::getToken($meet_schedule_id); ?>', '<?php echo User::getEmail_(); ?>', '<?php echo User::getNameIdentification(); ?>', <?php echo json_encode(Meet::getButtons($meet_schedule_id)); ?>);
|
||||||
const options = {
|
|
||||||
roomName: '<?php echo $meet->getName(); ?>',
|
|
||||||
jwt: '<?php echo Meet::getToken($meet_schedule_id); ?>',
|
|
||||||
parentNode: document.querySelector('#meet'),
|
|
||||||
userInfo: {
|
|
||||||
email: '<?php echo User::getEmail_(); ?>',
|
|
||||||
displayName: '<?php echo User::getNameIdentification(); ?>'
|
|
||||||
},
|
|
||||||
interfaceConfigOverwrite: {
|
|
||||||
TOOLBAR_BUTTONS: <?php echo json_encode(Meet::getButtons($meet_schedule_id)); ?>,
|
|
||||||
//SET_FILMSTRIP_ENABLED: false,
|
|
||||||
//DISABLE_FOCUS_INDICATOR: true,
|
|
||||||
//DISABLE_DOMINANT_SPEAKER_INDICATOR: true,
|
|
||||||
//DISABLE_VIDEO_BACKGROUND: true,
|
|
||||||
DISABLE_JOIN_LEAVE_NOTIFICATIONS: true,
|
|
||||||
disableAudioLevels: true,
|
|
||||||
requireDisplayName: true,
|
|
||||||
enableLayerSuspension: true,
|
|
||||||
channelLastN: 4,
|
|
||||||
startVideoMuted: 10,
|
|
||||||
startAudioMuted: 10,
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
const api = new JitsiMeetExternalAPI(domain, options);
|
|
||||||
|
|
||||||
api.addEventListeners({
|
|
||||||
readyToClose: readyToClose,
|
|
||||||
});
|
|
||||||
<?php
|
<?php
|
||||||
echo implode(PHP_EOL, $apiExecute);
|
echo implode(PHP_EOL, $apiExecute);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
function readyToClose() {
|
function readyToClose() {
|
||||||
document.location = "<?php echo $readyToClose; ?>";
|
document.location = "<?php echo $readyToClose; ?>";
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
<script>
|
|
||||||
var lastLiveStatus;
|
|
||||||
var eventMethod = window.addEventListener
|
|
||||||
? "addEventListener"
|
|
||||||
: "attachEvent";
|
|
||||||
var eventer = window[eventMethod];
|
|
||||||
var messageEvent = eventMethod === "attachEvent"
|
|
||||||
? "onmessage"
|
|
||||||
: "message";
|
|
||||||
eventer(messageEvent, function (e) {
|
|
||||||
if(typeof e.data.isLive !== 'undefined'){
|
|
||||||
if(lastLiveStatus !== e.data.isLive){
|
|
||||||
lastLiveStatus = e.data.isLive;
|
|
||||||
console.log("YPTMeetScript live status changed");
|
|
||||||
if(lastLiveStatus){
|
|
||||||
event_on_live();
|
|
||||||
}else{
|
|
||||||
event_on_liveStop();
|
|
||||||
}
|
|
||||||
event_on_liveStatusChange();
|
|
||||||
}
|
|
||||||
}else if(typeof e.data.YPTisReady !== 'undefined'){
|
|
||||||
console.log("YPTMeetScript is loaded");
|
|
||||||
event_on_meetReady();
|
|
||||||
}else if(typeof e.data.conferenceIsReady !== 'undefined'){
|
|
||||||
event_on_meetReady();
|
|
||||||
console.log("YPTMeetScript conference is ready");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// this is the script that will be executed in the iframe on Jitsi side
|
||||||
var jitsiIsLive = false;
|
var jitsiIsLive = false;
|
||||||
function setLivestreamURL() {
|
function setLivestreamURL() {
|
||||||
var selector = "input[name='streamId']";
|
var selector = "input[name='streamId']";
|
||||||
|
@ -47,6 +48,10 @@ function startYPTScripts() {
|
||||||
eventer(messageEvent, function (e) {
|
eventer(messageEvent, function (e) {
|
||||||
if (typeof e.data.hideElement !== 'undefined') {
|
if (typeof e.data.hideElement !== 'undefined') {
|
||||||
$(e.data.hideElement).hide();
|
$(e.data.hideElement).hide();
|
||||||
|
}else if (typeof e.data.append !== 'undefined') {
|
||||||
|
$(e.data.append.parentSelector).append(e.data.append.html);
|
||||||
|
}else if (typeof e.data.prepend !== 'undefined') {
|
||||||
|
$(e.data.prepend.parentSelector).prepend(e.data.prepend.html);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -310,7 +310,7 @@ if (User::isAdmin()) {
|
||||||
<label class="col-md-4 control-label"><?php echo __("Authenticated users can upload videos"); ?></label>
|
<label class="col-md-4 control-label"><?php echo __("Authenticated users can upload videos"); ?></label>
|
||||||
<div class="col-md-8 inputGroupContainer">
|
<div class="col-md-8 inputGroupContainer">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-addon"><i class="fa fa-cloud-upload"></i></span>
|
<span class="input-group-addon"><i class="fas fa-cloud-upload-alt"></i></span>
|
||||||
<select class="form-control" id="authCanUploadVideos" >
|
<select class="form-control" id="authCanUploadVideos" >
|
||||||
<option value="1" <?php echo ($config->getAuthCanUploadVideos() == 1) ? "selected" : ""; ?>><?php echo __("Yes"); ?></option>
|
<option value="1" <?php echo ($config->getAuthCanUploadVideos() == 1) ? "selected" : ""; ?>><?php echo __("Yes"); ?></option>
|
||||||
<option value="0" <?php echo ($config->getAuthCanUploadVideos() == 0) ? "selected" : ""; ?>><?php echo __("No"); ?></option>
|
<option value="0" <?php echo ($config->getAuthCanUploadVideos() == 0) ? "selected" : ""; ?>><?php echo __("No"); ?></option>
|
||||||
|
@ -323,7 +323,7 @@ if (User::isAdmin()) {
|
||||||
<label class="col-md-4 control-label"><?php echo __("Authenticated users can view chart"); ?></label>
|
<label class="col-md-4 control-label"><?php echo __("Authenticated users can view chart"); ?></label>
|
||||||
<div class="col-md-8 inputGroupContainer">
|
<div class="col-md-8 inputGroupContainer">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-addon"><i class="fa fa-cloud-upload"></i></span>
|
<span class="input-group-addon"><i class="fas fa-chart-bar"></i></span>
|
||||||
<select class="form-control" id="authCanViewChart" >
|
<select class="form-control" id="authCanViewChart" >
|
||||||
<option value="0" <?php echo ($config->getAuthCanViewChart() == 0) ? "selected" : ""; ?>><?php echo __("For uploaders"); ?></option>
|
<option value="0" <?php echo ($config->getAuthCanViewChart() == 0) ? "selected" : ""; ?>><?php echo __("For uploaders"); ?></option>
|
||||||
<option value="1" <?php echo ($config->getAuthCanViewChart() == 1) ? "selected" : ""; ?>><?php echo __("For selected, admin view"); ?></option>
|
<option value="1" <?php echo ($config->getAuthCanViewChart() == 1) ? "selected" : ""; ?>><?php echo __("For selected, admin view"); ?></option>
|
||||||
|
@ -336,7 +336,7 @@ if (User::isAdmin()) {
|
||||||
<label class="col-md-4 control-label"><?php echo __("Authenticated users can comment videos"); ?></label>
|
<label class="col-md-4 control-label"><?php echo __("Authenticated users can comment videos"); ?></label>
|
||||||
<div class="col-md-8 inputGroupContainer">
|
<div class="col-md-8 inputGroupContainer">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-addon"><i class="fa fa-commenting"></i></span>
|
<span class="input-group-addon"><i class="fas fa-comments"></i></span>
|
||||||
|
|
||||||
<select class="form-control" id="authCanComment" >
|
<select class="form-control" id="authCanComment" >
|
||||||
<option value="1" <?php echo ($config->getAuthCanComment() == 1) ? "selected" : ""; ?>><?php echo __("Yes"); ?></option>
|
<option value="1" <?php echo ($config->getAuthCanComment() == 1) ? "selected" : ""; ?>><?php echo __("Yes"); ?></option>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue