<?php
namespace FileRun;

use FileRun\Files\FM;

global $config;
if (!$config) {exit();}

if ($this->isLimitedPreview() && !$this->getSetting('allow_without_download')) {
	$this->centeredThumb();
	return true;
}
$URL = $this->actionURL.'&method=stream';
$videoStartTime = $_GET['videoStartTime'] ?? false;
if ($videoStartTime) {
	$URL .= '#t='.$videoStartTime;
}
$mime = FM\TypeInfo::mime_type($this->data['fileName']);
$loop = $this->getSetting('loop_playback');

$page = [
	'styles' => ['basic'],
	'loadMsg' => false,
	'title' => $this->data['fileName'],
	'manualEnd' => true
];
require $config['path']['includes'].'/ui/page/plugin.php';
?>
<script>
	document.addEventListener('contextmenu', (e) => {e.preventDefault();});
</script>
<style>
body {
	overflow: hidden;
	background-color: black;
}
video {
  width: 100%;
  height: 100%;
}
</style>
<video playsinline autoplay controls controlslist="nodownload" <?php if ($loop) {echo 'loop';}?> preload="auto" src="<?php echo $URL;?>" <?php if ($mime) {echo 'type="'.$mime.'"';}?>></video>
</body>
</html>