tytdarchive/www/watch.php

59 lines
1.9 KiB
PHP
Raw Permalink Normal View History

2024-06-22 04:03:20 +00:00
<?php
include("header-1.php");
?>
<title>TYTD Archive Player</title>
<?php
include("header-2.php");
include_once("db.php");
$id=$_GET["v"];
$stmt = $pdo->prepare("select * from SavedVideo where Id like '$id'");
$stmt->execute();
$video = $stmt->fetchAll()[0];
$title = $video["Title"];
$author_title = $video["AuthorTitle"];
$author_id = $video["AuthorId"];
$desc = $video["Description"];
$res = "PreMuxed";
if(isset($_GET["res"]))
{
$myRes = $_GET["res"];
if($myRes == "PreMuxed" || $myRes == "Mux" || $myRes == "AudioOnly" || $myRes == "VideoOnly")
{
$res = $myRes;
}
}
$curTime = "0";
if(isset($_GET["t"]))
{
$curTime = $_GET["t"];
}
$path= video_exists($_GET['v'],$res);
$exists = strlen($path) > 0;
?>
<?php
if($exists)
{
echo "<video src=\"./content/".$path."\" controls width=\"640\" height=\"480\"></video><br><a href=\"./content/".$path."\" class=\"btn btn-primary\" download=\"".htmlspecialchars($title)."-".$id.$ext."\">Download</a><!--<button click=\"copytimetoclipboard()\">Copy Link At Time</button>-->";
echo "<script>var vid = document.querySelector('video'); vid.currentTime = ".$curTime.";function copytimetoclipboard(){navigator.clipboard.writeText(`".$url_root."watch.php?v=".$id."&res=".$res."&t=\${vid.currentTime}`)}</script>";
}
else
{
echo "<a class=\"btn btn-primary\" href=\"".$tytd_root."api/AddVideo/".rawurlencode($id)."\">Add To Downloader</a><br><h1>This video does not exist, sorry</h1>";
}
?>
<h1><?php echo htmlspecialchars($title); ?></h1>
<h2><a href="./channel.php?id=<?php echo htmlspecialchars($author_id); ?>"><?php echo htmlspecialchars($author_title); ?></a></h2>
<hr>
<details>
<summary>Description</summary>
<p><?php echo htmlspecialchars($desc); ?></p>
</details>
<?php
include("footer.php");
?>