krying
Version:
krying — games hub, AI, movies, and tools
174 lines (163 loc) • 8.14 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Kobran - BloxTube</title>
<link rel="shortcut icon" type="image/png" href="/Kobran.png">
<link rel="stylesheet" href="/assets/kobran-page.css">
<style>
body.kobran-page{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px}
.tube-shell{width:min(1100px,100%);display:grid;grid-template-columns:1fr 320px;gap:18px}
@media(max-width:900px){.tube-shell{grid-template-columns:1fr}}
.tube-player,.tube-side{padding:20px;border-radius:16px;background:rgba(12,10,24,0.82);border:1px solid rgba(183,148,255,0.16);box-shadow:0 24px 80px rgba(0,0,0,0.35);backdrop-filter:blur(16px)}
.tube-media{position:relative;aspect-ratio:16/9;background:#000;border-radius:12px;overflow:hidden;border:1px solid rgba(255,255,255,0.08);margin-bottom:14px}
.tube-media video,.tube-media iframe,.tube-media .tube-audio{width:100%;height:100%;display:block;border:0;background:#000}
.tube-audio{display:flex;align-items:center;justify-content:center;color:rgba(255,255,255,0.55);font-size:0.95rem;background:radial-gradient(circle at 50% 30%,rgba(124,92,255,0.2),#050508)}
.tube-controls{display:flex;flex-wrap:wrap;gap:10px}
.tube-btn{padding:10px 16px;border:0;border-radius:999px;font-weight:700;font-size:0.78rem;letter-spacing:0.06em;text-transform:uppercase;cursor:pointer;color:#fff;background:linear-gradient(135deg,#7c3aed,#b794ff);box-shadow:0 8px 24px rgba(124,92,255,0.25)}
.tube-btn--ghost{background:rgba(255,255,255,0.06);border:1px solid rgba(183,148,255,0.2);box-shadow:none}
.tube-head{margin:0 0 14px;font-family:"Space Grotesk",Inter,sans-serif;font-size:1.2rem}
.tube-sub{margin:0 0 14px;color:rgba(255,255,255,0.52);font-size:0.86rem}
.tube-list{max-height:280px;overflow:auto;display:flex;flex-direction:column;gap:6px;margin-bottom:14px;padding-right:4px}
.tube-item{padding:10px 12px;border-radius:10px;background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.06);cursor:pointer;font-size:0.88rem;transition:background .2s,border-color .2s}
.tube-item:hover,.tube-item.active{background:rgba(183,148,255,0.12);border-color:rgba(183,148,255,0.28)}
.tube-form{display:flex;flex-direction:column;gap:8px}
.tube-form input,.tube-form select{padding:10px 12px;border-radius:10px;border:1px solid rgba(183,148,255,0.18);background:rgba(255,255,255,0.04);color:#fff;font:inherit;font-size:0.88rem}
.tube-form input[type=file]{padding:8px}
.tube-back{display:inline-flex;margin-bottom:18px}
</style>
</head>
<body class="kobran-page">
<div class="kobran-page__glow" aria-hidden="true"></div>
<div class="kobran-page__wrap" style="width:min(1120px,calc(100vw - 32px));padding-top:12px">
<a class="kobran-page__link tube-back" href="/apps/">← Back to Apps</a>
<div class="tube-shell">
<section class="tube-player">
<h1 class="tube-head">BloxTube</h1>
<p class="tube-sub">Video and music player with playlist support.</p>
<div class="tube-media">
<video id="video" controls hidden></video>
<iframe id="ytFrame" hidden allow="autoplay; encrypted-media" allowfullscreen></iframe>
<div class="tube-audio" id="blackScreen" hidden>Now playing audio</div>
</div>
<div class="tube-controls">
<button type="button" class="tube-btn" id="play">Play</button>
<button type="button" class="tube-btn tube-btn--ghost" id="stop">Stop</button>
<button type="button" class="tube-btn tube-btn--ghost" id="restart">Restart</button>
</div>
</section>
<aside class="tube-side">
<h2 class="tube-head" style="font-size:1rem">Playlist</h2>
<div class="tube-list" id="playlist"></div>
<div class="tube-form">
<input type="text" id="urlInput" placeholder="Video, YouTube, or music URL">
<select id="typeSelect">
<option value="video">Video</option>
<option value="music">Music</option>
</select>
<button type="button" class="tube-btn" id="addUrlBtn">Add to playlist</button>
<input type="file" id="fileInput" accept="audio/*,video/*" multiple>
</div>
</aside>
</div>
</div>
<script>
const video = document.getElementById("video");
const audio = new Audio();
const ytFrame = document.getElementById("ytFrame");
const blackScreen = document.getElementById("blackScreen");
const playlistEl = document.getElementById("playlist");
let playlist = [
{ title: "Flowers", src: "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4", type: "video" },
{ title: "Random Music", src: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3", type: "music" },
{ title: "Rick Roll", src: "https://www.youtube.com/watch?v=dQw4w9WgXcQ", embed: "https://www.youtube.com/embed/dQw4w9WgXcQ", type: "video", isYouTube: true }
];
let current = -1;
function hideMedia() {
video.hidden = true;
ytFrame.hidden = true;
blackScreen.hidden = true;
video.pause();
audio.pause();
}
function renderPlaylist() {
playlistEl.innerHTML = "";
playlist.forEach(function (item, i) {
const el = document.createElement("button");
el.type = "button";
el.className = "tube-item" + (i === current ? " active" : "");
el.textContent = item.title;
el.onclick = function () { selectItem(i); };
playlistEl.appendChild(el);
});
}
function selectItem(i) {
current = i;
const item = playlist[i];
hideMedia();
if (item.isYouTube) {
ytFrame.src = item.embed;
ytFrame.hidden = false;
} else if (item.type === "video") {
video.src = item.src;
video.hidden = false;
video.play();
} else {
audio.src = item.src;
blackScreen.hidden = false;
audio.play();
}
renderPlaylist();
}
function playCurrent() {
if (current === -1 && playlist.length) selectItem(0);
else if (current >= 0) {
const item = playlist[current];
if (item.isYouTube) ytFrame.contentWindow && ytFrame.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', "*");
else if (item.type === "video") video.play();
else audio.play();
}
}
function stopCurrent() {
if (current === -1) return;
const item = playlist[current];
if (item.isYouTube) ytFrame.src = item.embed;
else if (item.type === "video") { video.pause(); video.currentTime = 0; }
else { audio.pause(); audio.currentTime = 0; }
}
function restartCurrent() {
if (current === -1) return;
const item = playlist[current];
if (item.isYouTube) ytFrame.src = item.embed + "?autoplay=1";
else if (item.type === "video") { video.currentTime = 0; video.play(); }
else { audio.currentTime = 0; audio.play(); }
}
function getYouTubeEmbed(url) {
const match = url.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)/);
return match ? "https://www.youtube.com/embed/" + match[1] : null;
}
document.getElementById("addUrlBtn").onclick = function () {
const url = document.getElementById("urlInput").value.trim();
const type = document.getElementById("typeSelect").value;
if (!url) return;
const embed = getYouTubeEmbed(url);
if (embed) playlist.push({ title: "YouTube video", src: url, embed: embed, type: "video", isYouTube: true });
else playlist.push({ title: url.split("/").pop() || url, src: url, type: type });
document.getElementById("urlInput").value = "";
renderPlaylist();
};
document.getElementById("fileInput").addEventListener("change", function (e) {
Array.from(e.target.files || []).forEach(function (file) {
playlist.push({ title: file.name, src: URL.createObjectURL(file), type: file.type.startsWith("video") ? "video" : "music" });
});
renderPlaylist();
e.target.value = "";
});
document.getElementById("play").onclick = playCurrent;
document.getElementById("stop").onclick = stopCurrent;
document.getElementById("restart").onclick = restartCurrent;
renderPlaylist();
</script>
</body>
</html>