diff --git a/plugin/Live/meet.php b/plugin/Live/meet.php index 9fdb5a83f..e12b14375 100644 --- a/plugin/Live/meet.php +++ b/plugin/Live/meet.php @@ -1,238 +1,238 @@ ".__("The server is not ready").""; return ''; } if ($meetDomain == 'custom') { $domain = $objM->CUSTOM_JITSI_DOMAIN; } else { $domain = "{$meetDomain}?getRTMPLink=" . urlencode(Live::getRTMPLink(User::getId())); } $dropURL = "{$global['webSiteRootURL']}plugin/Live/droplive.json.php?live_transmition_id={$trasnmition['id']}&live_servers_id=" . Live::getCurrentLiveServersId(); ?>
\ No newline at end of file diff --git a/plugin/Live/webRTC.js b/plugin/Live/webRTC.js new file mode 100644 index 000000000..43062f67a --- /dev/null +++ b/plugin/Live/webRTC.js @@ -0,0 +1,37 @@ + +window.addEventListener('message', event => { + if (event.data.startLiveRestream) { + startLiveRestream(event.data.m3u8); + } +}); + +function startLiveRestream(m3u8) { + //console.log('WebRTCLiveCam: startLive'); + modal.showPleaseWait(); + $.ajax({ + url: webSiteRootURL + '/plugin/Live/webRTCToLive.json.php', + method: 'POST', + data: { + 'm3u8': m3u8, + 'live_servers_id': '' + }, + success: function (response) { + if (response.error) { + webRTCDisconnect(); + avideoAlertError(response.msg); + } else { + avideoToastSuccess(response.msg); + //document.querySelector("iframe").contentWindow.postMessage({setLiveStart: 1}, "*"); + } + modal.hidePleaseWait(); + } + }); +} + +function webRTCConnect() { + document.querySelector("iframe").contentWindow.postMessage({setLiveStart: 1}, "*"); +} + +function webRTCDisconnect() { + document.querySelector("iframe").contentWindow.postMessage({setLiveStop: 1}, "*"); +} \ No newline at end of file diff --git a/plugin/Live/webRTC.php b/plugin/Live/webRTC.php index 0733bb5b6..3f7fe2593 100644 --- a/plugin/Live/webRTC.php +++ b/plugin/Live/webRTC.php @@ -1,59 +1,62 @@ + + + \ No newline at end of file diff --git a/plugin/Live/webRTCToLive.json.php b/plugin/Live/webRTCToLive.json.php index 69c9fa862..8421e8e92 100644 --- a/plugin/Live/webRTCToLive.json.php +++ b/plugin/Live/webRTCToLive.json.php @@ -1,52 +1,52 @@ error = true; $obj->msg = ""; $obj->response = ""; if (!User::canStream()) { $obj->msg = __("Permition denied"); die(json_encode($obj)); } $live = AVideoPlugin::loadPluginIfEnabled("Live"); require_once './Objects/LiveTransmition.php'; if (empty($live)) { $obj->msg = __("Plugin disabled"); die(json_encode($obj)); } if (!isValidURL($_REQUEST['m3u8'])) { $obj->msg = 'Invalid m3u8'; die(json_encode($obj)); } _error_log('webRTCToLive: start'); $users_id = User::getId(); $count = 1; while ($count <= 4) { - sleep(5); + sleep(10); $count++; if (isURL200($_REQUEST['m3u8'], true)) { break; }else{ _error_log('webRTCToLive: wait till 200 '.$_REQUEST['m3u8']); } } $obj->response = Live::reverseRestream($_REQUEST['m3u8'], $users_id, @$_REQUEST['live_servers_id']); $obj->error = false; _error_log('webRTCToLive: complete'); die(json_encode($obj));