forked from anime-kun32/AniTeams-amvstrm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patho.html
More file actions
279 lines (235 loc) · 6.07 KB
/
o.html
File metadata and controls
279 lines (235 loc) · 6.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom Video Player</title>
<script src="https://cdn.jsdelivr.net/npm/@oplayer/core@latest/dist/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@oplayer/ui@latest/dist/index.min.js"></script>
<style>
body,
html {
margin: 0;
padding: 0;
width: 100%;
width: 100svw;
height: 100vh;
height: 100svh;
font-family: Arial, Helvetica, sans-serif;
}
@media (min-width: 640px) {
* {
user-select: none !important;
-webkit-user-select: none !important;
-khtml-user-select: none !important;
-moz-user-select: none !important;
-ms-user-select: none !important;
}
}
a,
button,
img {
-webkit-tap-highlight-color: rgba(255, 255, 255, 0) !important;
-webkit-tap-highlight-color: transparent !important;
}
button {
border-radius: 0.35rem !important;
}
.spinner {
animation: spinner 0.9s infinite linear;
}
@keyframes spinner {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
#oplayer {
width: 100% !important;
height: 100% !important;
}
video {
height: 100% !important;
max-width: 100%;
object-position: center;
object-fit: contain !important;
}
/* overriding */
.css-1ftojuw {
--primary-color: white !important;
}
.css-1xk8bpn {
width: calc(100% + 5px);
margin-left: -2px;
}
.css-1gyrt30[aria-checked='true'] .css-l3w6ir {
background-color: white !important;
}
#oplayer .css-l3w6ir::before {
background-color: black;
}
#oplayer [aria-label='Setting'],
#oplayer .playlist,
#oplayer .css-fy6n4p {
border-radius: 1rem;
background-color: rgba(0, 0, 0, 0.75);
/* backdrop-filter: blur(5px); */
}
#oplayer [role='menu'] {
padding: 0.5rem;
min-width: 18rem;
}
@media (min-width: 640px) {
[role='menu'] {
min-width: 20rem;
}
}
@media (min-width: 1280px) {
[role='menu'] {
min-width: 22rem;
}
}
[role='menuitem'] {
border-radius: 0.7rem;
overflow: hidden;
height: 2.8rem;
}
[role='menuitem'] div {
height: 100%;
}
#oplayer [role='menuitemradio'] {
border-radius: 0.5rem;
overflow: hidden;
justify-content: start !important;
gap: 1rem !important;
height: 2.8rem;
font-size: 0.85rem !important;
}
[role='menuitemradio'] svg {
order: -9999 !important;
-ms-flex-order: -9999 !important;
display: block !important;
opacity: 0;
}
[role='menuitemradio'][aria-checked='true'] svg {
opacity: 1 !important;
}
[aria-label='Play'][type='button'] {
background: transparent !important;
}
[aria-label='Play'][type='button']::before {
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect width='24' height='24' fill='none'/%3E%3Cpath fill='white' fill-rule='evenodd' d='M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2S2 6.477 2 12s4.477 10 10 10' clip-rule='evenodd' opacity='0.4'/%3E%3Cpath fill='white' d='m15.414 13.059l-4.72 2.787C9.934 16.294 9 15.71 9 14.786V9.214c0-.924.934-1.507 1.694-1.059l4.72 2.787c.781.462.781 1.656 0 2.118'/%3E%3C/svg%3E");
width: 4rem;
height: 4rem;
display: block;
/* filter: drop-shadow(0 10px 8px rgb(0 0 0 / 0.04)) drop-shadow(0 4px 3px rgb(0 0 0 / 0.1)); */
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
flex-shrink: 0;
}
@media (min-width: 1280px) {
[aria-label='Play'][type='button']::before {
width: 5rem;
height: 5rem;
}
}
@media (max-width: 640px) {
[aria-label='Screenshot'] {
display: none !important;
}
}
#oplayer .playlist-list-item {
margin: 0 0.5rem 0.5rem;
border-radius: 0.7rem;
border: none;
}
#oplayer .playlist-head {
border-bottom: none;
background: transparent;
}
.playlist-list-item-thumb,
.playlist-list-item-thumb img {
border-radius: 0.5rem;
}
.playlist-back {
border-radius: 0.35rem !important;
}
.css-1y9tj12 {
padding-top: 0.5em;
}
</style>
</head>
<body>
<div id="oplayer"></div>
</div>
<script src="https://cdn.jsdelivr.net/npm/eruda"></script>
<script>eruda.init();</script>
<script>
function getParam(param) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(param);
}
// Function to apply proxy URL
function applyProxy(url) {
const proxyURL = 'https://gogoanime-and-hianime-proxy.vercel.app/hls-proxy?url=';
return proxyURL + encodeURIComponent(url);
}
// Load video info from API using the ID from URL parameters
async function loadVideoData() {
const id = getParam('id');
const apiUrl = `https://api-consumet-org-gamma.vercel.app/meta/anilist/watch/${id}`;
try {
const response = await fetch(apiUrl);
const data = await response.json();
if (data.code === 200 && data.info && data.stream) {
initializePlayer(data);
} else {
console.error("Failed to fetch video data.");
}
} catch (error) {
console.error("API error:", error);
}
}
// Initialize OPlayer with video data and resume position if available
function initializePlayer(data) {
const { title } = data.info;
const { url, isM3U8 } = data.stream.multi.main;
const thumbnailUrl = data.stream.tracks.file;
// Apply the proxy to the stream URL
const proxiedUrl = applyProxy(url);
const player = OPlayer.make('#oplayer', {
source: {
title: title,
src: proxiedUrl, // Use the proxied URL
type: isM3U8 ? 'application/x-mpegURL' : 'video/mp4',
poster: 'https://cdn.jsdelivr.net/gh/shiyiya/QI-ABSL@master/o/poster.png',
thumbnails: {
src: thumbnailUrl
}
},
})
.use([OUI()])
.create();
// Check local storage for saved time and resume if available
const savedTime = localStorage.getItem(`progress-${data.info.id}`);
if (savedTime) {
player.seek(Number(savedTime));
}
// Save progress every second
player.on('timeupdate', () => {
localStorage.setItem(`progress-${data.info.id}`, player.currentTime());
});
// Remove progress when video ends
player.on('ended', () => {
localStorage.removeItem(`progress-${data.info.id}`);
});
}
// Load video data and initialize player
loadVideoData();
</script>
</body>
</html>