-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiptv.js
55 lines (50 loc) · 1.87 KB
/
iptv.js
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
document.addEventListener("DOMContentLoaded", function() {
let videoList = [];
let currentIndex = 0;
// Videoları JSON'dan al
fetch('videolist.json')
.then(response => response.json())
.then(data => {
// NSFW ve default videoları birleştir
videoList = [...data.defaultVideos, ...data.nsfwVideos];
// Videoları karıştır
videoList = videoList.sort(() => Math.random() - 0.5);
loadVideo();
})
.catch(error => console.error('JSON yüklenirken hata:', error));
function loadVideo() {
if (videoList.length > 0) {
const videoPlayer = document.getElementById('iptvPlayer');
const videoSource = document.getElementById('videoSource');
videoSource.src = videoList[currentIndex];
videoPlayer.load();
}
}
document.getElementById('prevVideo').addEventListener('click', function() {
if (videoList.length > 0) {
currentIndex = (currentIndex - 1 + videoList.length) % videoList.length;
loadVideo();
}
});
document.getElementById('nextVideo').addEventListener('click', function() {
if (videoList.length > 0) {
currentIndex = (currentIndex + 1) % videoList.length;
loadVideo();
}
});
document.getElementById('nsfwToggle').addEventListener('change', function() {
const isNSFW = this.checked;
fetch('videolist.json')
.then(response => response.json())
.then(data => {
if (isNSFW) {
videoList = data.nsfwVideos;
} else {
videoList = data.defaultVideos;
}
videoList = videoList.sort(() => Math.random() - 0.5);
currentIndex = 0;
loadVideo();
});
});
});