diff --git a/plugin/Live/getImage.php b/plugin/Live/getImage.php index 7bc39c8f6..f44930d92 100644 --- a/plugin/Live/getImage.php +++ b/plugin/Live/getImage.php @@ -1,53 +1,55 @@ userCanSeeTransmition()){ $uuid = $livet['key']; $p = YouPHPTubePlugin::loadPlugin("Live"); $video = "{$p->getM3U8File($uuid)}"; $url = $config->getEncoderURL()."getImage/". base64_encode($video)."/{$_GET['format']}"; + error_log("Live:getImage $url"); + if (empty($_SESSION[$url]['expire']) || $_SESSION[$url]['expire'] < time()) { $content = url_get_contents($url); if (session_status() == PHP_SESSION_NONE) { session_start(); } error_log("Live:getImage Image Expired in ". date("d/m/Y H:i:s", @$_SESSION[$url]['expire'])." NOW is ". date("d/m/Y H:i:s")); $_SESSION[$url] = array('content' => $content, 'expire' => strtotime("+2 min")); error_log("Live:getImage New Image will Expired in ". date("d/m/Y H:i:s", $_SESSION[$url]['expire'])." NOW is ". date("d/m/Y H:i:s")); } if(!empty($_SESSION[$url]['content'])){ echo $_SESSION[$url]['content']; error_log("Live:getImage Cached Good until ". date("d/m/Y H:i:s", $_SESSION[$url]['expire'])." NOW is ". date("d/m/Y H:i:s")); }else{ echo file_get_contents($filename); error_log("Live:getImage Get default image "); } }else{ error_log("Live:getImage Can not see the image"); } $p = YouPHPTubePlugin::loadPluginIfEnabled("Cache"); if(!empty($p)){ $p->getEnd(); } \ No newline at end of file