Spaces:
Running
Running
Commit ·
f88e88a
1
Parent(s): 40a865b
Load
Browse files- Ark ReCode/index.html +1 -1
- Ark ReCode/script.js +4 -23
- index.html +7 -1
Ark ReCode/index.html
CHANGED
|
@@ -19,7 +19,7 @@
|
|
| 19 |
<input type="text" id="charName" placeholder="Masukkan nama karakter...">
|
| 20 |
<button onclick="fetchData()">Cari</button>
|
| 21 |
<br>
|
| 22 |
-
<button class="chara" onclick="playVideo(
|
| 23 |
<button class="chara" onclick="playVideo('Ermes')">Ermes</button>
|
| 24 |
<div id="result"></div>
|
| 25 |
</div>
|
|
|
|
| 19 |
<input type="text" id="charName" placeholder="Masukkan nama karakter...">
|
| 20 |
<button onclick="fetchData()">Cari</button>
|
| 21 |
<br>
|
| 22 |
+
<button class="chara" onclick="playVideo()">Edalia</button>
|
| 23 |
<button class="chara" onclick="playVideo('Ermes')">Ermes</button>
|
| 24 |
<div id="result"></div>
|
| 25 |
</div>
|
Ark ReCode/script.js
CHANGED
|
@@ -1,37 +1,18 @@
|
|
| 1 |
function playVideo(charName) {
|
| 2 |
-
const
|
| 3 |
-
const videoPath = `https://gilbertclaus.pythonanywhere.com/video/Ark ReCode/${charName}/${cleanName}.m3u8`;
|
| 4 |
-
const encodedURL = encodeURI(videoPath);
|
| 5 |
|
| 6 |
const wrapper = document.getElementById("videoWrapper");
|
| 7 |
wrapper.innerHTML = "";
|
| 8 |
|
| 9 |
const video = document.createElement("video");
|
|
|
|
| 10 |
video.width = 360;
|
| 11 |
video.controls = true;
|
| 12 |
video.autoplay = true;
|
| 13 |
-
video.volume = 0.
|
| 14 |
video.style.marginTop = "20px";
|
| 15 |
wrapper.appendChild(video);
|
| 16 |
-
|
| 17 |
-
if (Hls.isSupported()) {
|
| 18 |
-
const hls = new Hls();
|
| 19 |
-
hls.loadSource(encodedURL);
|
| 20 |
-
hls.attachMedia(video);
|
| 21 |
-
hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
| 22 |
-
video.play();
|
| 23 |
-
});
|
| 24 |
-
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
| 25 |
-
// Safari atau browser yang sudah dukung .m3u8
|
| 26 |
-
video.src = encodedURL;
|
| 27 |
-
video.addEventListener('loadedmetadata', () => {
|
| 28 |
-
video.play();
|
| 29 |
-
});
|
| 30 |
-
} else {
|
| 31 |
-
// Fallback, tidak bisa memutar HLS
|
| 32 |
-
wrapper.innerHTML = "<p>Browser kamu tidak mendukung streaming video ini.</p>";
|
| 33 |
-
}
|
| 34 |
-
}
|
| 35 |
|
| 36 |
function fetchData() {
|
| 37 |
const input = document.getElementById("charName").value.trim();
|
|
|
|
| 1 |
function playVideo(charName) {
|
| 2 |
+
const videoPath = `https://gilbertclaus.pythonanywhere.com/video/${encodeURIComponent("Ark ReCode")}/${encodeURIComponent(charName)}.mp4`;
|
|
|
|
|
|
|
| 3 |
|
| 4 |
const wrapper = document.getElementById("videoWrapper");
|
| 5 |
wrapper.innerHTML = "";
|
| 6 |
|
| 7 |
const video = document.createElement("video");
|
| 8 |
+
video.src = videoPath;
|
| 9 |
video.width = 360;
|
| 10 |
video.controls = true;
|
| 11 |
video.autoplay = true;
|
| 12 |
+
video.volume = 0.3; // sedikit dinaikkan
|
| 13 |
video.style.marginTop = "20px";
|
| 14 |
wrapper.appendChild(video);
|
| 15 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
function fetchData() {
|
| 18 |
const input = document.getElementById("charName").value.trim();
|
index.html
CHANGED
|
@@ -63,8 +63,14 @@
|
|
| 63 |
}
|
| 64 |
}
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
function ark() {
|
| 67 |
-
|
|
|
|
|
|
|
| 68 |
}
|
| 69 |
</script>
|
| 70 |
|
|
|
|
| 63 |
}
|
| 64 |
}
|
| 65 |
|
| 66 |
+
// function ark() {
|
| 67 |
+
// window.location.href = "./Ark%20ReCode";
|
| 68 |
+
// }
|
| 69 |
+
|
| 70 |
function ark() {
|
| 71 |
+
const urlInput = document.getElementById("urlInput");
|
| 72 |
+
urlInput.value = "https://huggingface.co/spaces/GilbertClaus/Test-HTML/resolve/main/Ark%20ReCode/index.html";
|
| 73 |
+
loadWebsite();
|
| 74 |
}
|
| 75 |
</script>
|
| 76 |
|