Remove custom video player, just use compat as default

This commit is contained in:
bingus_violet 2024-07-01 20:57:56 -05:00
parent 34a6cd3458
commit 3810ec0feb
2 changed files with 1 additions and 31 deletions

View file

@ -72,35 +72,6 @@ app.get("/watch/*", (req, res) => {
res.send(html) res.send(html)
}) })
app.get("/video/*", (req, res) => {
var video = req.params[0]
var vidPath = path.join(directory, video)
if (!fs.existsSync(vidPath)) {
vidPath = path.join(pubDir, video)
}
const range = req.headers.range
const videoPath = vidPath;
const videoSize = fs.statSync(videoPath).size
const chunkSize = 1 * 1e6;
const start = Number(range.replace(/\D/g, ""))
const end = Math.min(start + chunkSize, videoSize - 1)
const contentLength = end - start + 1;
const headers = {
"Content-Range": `bytes ${start}-${end}/${videoSize}`,
"Accept-Ranges": "bytes",
"Content-Length": contentLength,
"Content-Type": "video/mkv"
}
res.writeHead(206, headers)
const stream = fs.createReadStream(videoPath, {
start,
end
})
stream.pipe(res)
})
app.get("/download/*", (req, res) => { app.get("/download/*", (req, res) => {
var download = req.params[0] var download = req.params[0]
var downloadPath = path.join(directory, download) var downloadPath = path.join(directory, download)

View file

@ -27,9 +27,8 @@
<p><a href="{BACK}">Back</a></p> <p><a href="{BACK}">Back</a></p>
<p>{VID_INFO}</p> <p>{VID_INFO}</p>
<p><a href="/download/{VID_PATH}">Download</a> <p><a href="/download/{VID_PATH}">Download</a>
<br><a href="/{VID_PATH}">Compatibility Video player</a></p>
<div class="fadediv"> <div class="fadediv">
<video src="/video/{VID_PATH}" width="100%" controls></video> <video src="/{VID_PATH}" width="100%" controls></video>
</div> </div>
<p class="note">Please note that the video player is unfinished, most commonly having issues on iOS devices.</p> <p class="note">Please note that the video player is unfinished, most commonly having issues on iOS devices.</p>
</body> </body>