Spaces:
Running
Running
Edit
Browse files- vidstack.html +98 -0
vidstack.html
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<link rel="preconnect" href="https://rsms.me/">
|
7 |
+
<link rel="stylesheet" href="https://rsms.me/inter/inter.css">
|
8 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
9 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
10 |
+
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">
|
11 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vidstack/styles/defaults.min.css" />
|
12 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vidstack/styles/community-skin/video.min.css" />
|
13 |
+
<script type="module" src="https://cdn.jsdelivr.net/npm/vidstack/dist/cdn/prod.js"></script>
|
14 |
+
<style>
|
15 |
+
:root { font-family: 'Inter', sans-serif; }
|
16 |
+
@supports (font-variation-settings: normal) {
|
17 |
+
:root { font-family: 'Inter var', sans-serif; }
|
18 |
+
}
|
19 |
+
body {
|
20 |
+
margin: 0;
|
21 |
+
background-color: #000000;
|
22 |
+
width: 100vw;
|
23 |
+
height: 100vh;
|
24 |
+
font-family: 'Inter', 'Noto Sans JP', sans-serif;
|
25 |
+
}
|
26 |
+
.wrapper {
|
27 |
+
height: 100vh;
|
28 |
+
display: flex;
|
29 |
+
flex-direction: column;
|
30 |
+
}
|
31 |
+
#player {
|
32 |
+
flex-grow: 1;
|
33 |
+
height: 100%;
|
34 |
+
width: 100%;
|
35 |
+
font-family: 'Inter', 'Noto Sans JP', sans-serif;
|
36 |
+
}
|
37 |
+
media-player {
|
38 |
+
--media-font-family: 'Inter', 'Noto Sans JP' !important;
|
39 |
+
}
|
40 |
+
footer.copyrightDisp {
|
41 |
+
position: fixed;
|
42 |
+
left: 0;
|
43 |
+
bottom: 0;
|
44 |
+
padding: 0;
|
45 |
+
margin: 0 0 10px 10px;
|
46 |
+
color: #ffffff80;
|
47 |
+
z-index: 2;
|
48 |
+
user-select: none;
|
49 |
+
}
|
50 |
+
</style>
|
51 |
+
</head>
|
52 |
+
<body>
|
53 |
+
<div class="wrapper">
|
54 |
+
<media-player
|
55 |
+
title=""
|
56 |
+
aspect-ratio="16/9"
|
57 |
+
crossorigin
|
58 |
+
id="player"
|
59 |
+
>
|
60 |
+
<media-outlet id="player-media-outlet-el">
|
61 |
+
</media-outlet>
|
62 |
+
<media-community-skin></media-community-skin>
|
63 |
+
</media-player>
|
64 |
+
</div>
|
65 |
+
<!-- <footer class="copyrightDisp">
|
66 |
+
Resources are created for research purposes.<br>
|
67 |
+
(C) 2023 Tappei Nagatsuki, KADOKAWA, daydreamer-json
|
68 |
+
</footer> -->
|
69 |
+
<script>
|
70 |
+
window.addEventListener('load', function(){
|
71 |
+
const player = document.querySelector('media-player');
|
72 |
+
const pageUrlLocationHref = new URL(location.href);
|
73 |
+
const pageSearchParams = pageUrlLocationHref.searchParams;
|
74 |
+
if (pageSearchParams.has("url") === true) {
|
75 |
+
player.onAttach(() => {
|
76 |
+
const outletElement = document.querySelector('#player-media-outlet-el');
|
77 |
+
const sourceElement = document.createElement("source");
|
78 |
+
sourceElement.src = pageSearchParams.get("url");
|
79 |
+
outletElement.appendChild(sourceElement);
|
80 |
+
})
|
81 |
+
} else {
|
82 |
+
const promptedUrl = prompt("Please input source URL");
|
83 |
+
if (promptedUrl === "") {
|
84 |
+
alert("Source not found");
|
85 |
+
} else {
|
86 |
+
player.onAttach(() => {
|
87 |
+
const outletElement = document.querySelector('#player-media-outlet-el');
|
88 |
+
const sourceElement = document.createElement("source");
|
89 |
+
sourceElement.src = promptedUrl;
|
90 |
+
outletElement.appendChild(sourceElement);
|
91 |
+
})
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
});
|
96 |
+
</script>
|
97 |
+
</body>
|
98 |
+
</html>
|