forked from anime-kun32/AniTeams-amvstrm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathignore.html
More file actions
198 lines (170 loc) · 6.58 KB
/
ignore.html
File metadata and controls
198 lines (170 loc) · 6.58 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Anime Streaming - Vidstack Video Player</title>
<link rel="stylesheet" href="https://cdn.vidstack.io/player/theme.css">
<link rel="stylesheet" href="https://cdn.vidstack.io/player/video.css">
<script src="https://cdn.tailwindcss.com"></script>
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
font-family: 'Arial', sans-serif;
background: url('https://example.com/path-to-anime-background.jpg') no-repeat center center fixed;
background-size: cover;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
backdrop-filter: blur(10px);
background-color: rgba(0, 0, 0, 0.7);
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
h1 {
color: #fff;
text-align: center;
font-size: 2.5rem;
margin-bottom: 20px;
}
vds-player {
width: 100vw;
height: 80vh;
background: #000;
box-sizing: border-box;
border-radius: 10px;
overflow: hidden;
}
.footer {
color: #fff;
text-align: center;
margin-top: 10px;
}
.episode-title {
color: #fff;
font-size: 1.2rem;
}
.active-episode {
color: #ffcc00; /* Highlight color for the active episode */
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<h1 id="anime-title">Anime Title Here</h1> <!-- Title will be dynamically updated -->
<vds-player id="player"></vds-player>
<div id="episodes-section" class="mt-4 w-full max-w-xl">
<h2 class="text-xl text-white mb-2">Episodes</h2>
<div id="episode-list" class="flex flex-col space-y-2">
<!-- Episode items will be injected here -->
</div>
</div>
<div class="footer">
© 2024 Anime Streaming Service
</div>
</div>
<script src="https://cdn.vidstack.io/player" type="module"></script>
<script src="https://cdn.vidstack.io/player.dev" type="module"></script>
<script src="https://cdn.vidstack.io/player@1.11.21" type="module"></script>
<script type="module">
import { VidstackPlayer, VidstackPlayerLayout } from 'https://cdn.vidstack.io/player';
function getUrlParams() {
const params = new URLSearchParams(window.location.search);
return {
id: params.get('id')
};
}
function trimId(id) {
const parts = id.split('-');
return parts.slice(0, parts.length - 2).join('-');
}
async function fetchVideoData(id) {
const response = await fetch(`https://api-p1xr.vercel.app/api/v2/stream/${id}`);
const data = await response.json();
return data;
}
async function fetchEpisodes(trimmedId) {
const response = await fetch(`https://api-p1xr.vercel.app/api/v1/episodes/${trimmedId}`);
const data = await response.json();
return data;
}
async function initializePlayer() {
const params = getUrlParams();
const data = await fetchVideoData(params.id);
const mainStream = data.stream.multi.main.url;
const backupStream = data.stream.multi.backup.url;
const thumbnailTrack = data.stream.tracks;
// Set the anime title dynamically
document.getElementById('anime-title').textContent = data.info.title;
const player = await VidstackPlayer.create({
target: '#player',
title: data.info.title,
src: mainStream,
poster: '',
layout: new VidstackPlayerLayout({
thumbnails: thumbnailTrack ? thumbnailTrack : '',
}),
});
// Event listeners for play and pause
player.addEventListener('play', () => {
console.log('Video is playing');
});
player.addEventListener('pause', () => {
console.log('Video is paused');
});
// Add settings menu for switching between main and backup streams
player.settings = [
{
html: 'Stream',
selector: [
{ html: 'Main', url: mainStream, default: true },
{ html: 'Backup', url: backupStream },
],
onSelect: function (item) {
player.src = item.url;
return item.html;
},
},
];
// Fetch and display episodes
const trimmedId = trimId(params.id);
const episodesData = await fetchEpisodes(trimmedId);
displayEpisodes(episodesData.episodes, params.id);
}
function displayEpisodes(episodes, currentId) {
const episodeList = document.getElementById('episode-list');
episodeList.innerHTML = ''; // Clear existing list
episodes.forEach(episode => {
const episodeElement = document.createElement('div');
episodeElement.textContent = episode.title;
episodeElement.classList.add('episode-title', 'cursor-pointer');
// Highlight current episode
if (currentId === episode.id) {
episodeElement.classList.add('active-episode');
}
episodeElement.addEventListener('click', () => {
const newId = episode.id;
updateUrl(newId);
location.reload(); // Refresh the page to load the new episode
});
episodeList.appendChild(episodeElement);
});
}
function updateUrl(newId) {
const params = new URLSearchParams(window.location.search);
params.set('id', newId);
window.history.pushState({}, '', `${window.location.pathname}?${params}`);
}
// Initialize player
initializePlayer();
</script>
</body>
</html>