68 lines
1.9 KiB
HTML
68 lines
1.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>{{ title }} - yt-dlp Proxy</title>
|
|
<link rel="stylesheet" href="https://unpkg.com/mvp.css">
|
|
<style>
|
|
body {
|
|
max-width: 900px;
|
|
margin: 0 auto;
|
|
padding: 1rem;
|
|
}
|
|
h1 {
|
|
margin-bottom: 1rem;
|
|
}
|
|
.video-container {
|
|
width: 100%;
|
|
background: #000;
|
|
aspect-ratio: 16 / 9;
|
|
}
|
|
video {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
.back-link {
|
|
display: inline-block;
|
|
margin-bottom: 1rem;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<a href="/" class="back-link">← Back</a>
|
|
<h1>{{ title }}</h1>
|
|
<div class="video-container">
|
|
<video controls id="video">
|
|
Your browser does not support video playback.
|
|
</video>
|
|
</div>
|
|
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
|
|
<script>
|
|
const video = document.getElementById('video');
|
|
const hlsUrl = {{ proxy_hls_url | tojson }};
|
|
const directUrl = {{ direct_url | tojson }};
|
|
|
|
if (hlsUrl && hlsUrl !== 'null') {
|
|
if (Hls.isSupported()) {
|
|
const hls = new Hls();
|
|
hls.loadSource(hlsUrl);
|
|
hls.attachMedia(video);
|
|
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
|
video.src = hlsUrl;
|
|
} else {
|
|
loadDirectUrl();
|
|
}
|
|
} else if (directUrl && directUrl !== 'null') {
|
|
loadDirectUrl();
|
|
}
|
|
|
|
function loadDirectUrl() {
|
|
if (directUrl && directUrl !== 'null') {
|
|
video.src = directUrl;
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|