-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayVideos.js
More file actions
90 lines (76 loc) · 3.07 KB
/
Copy pathplayVideos.js
File metadata and controls
90 lines (76 loc) · 3.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
document.addEventListener('DOMContentLoaded', function() {
const videos = [
'bmffabtttc', 'gilpbn5szf', 'nhy18vfspa', 'islnti0all', 'i4ovggtyvx'
];
let currentVideoIndex = 0;
function removeUnwantedElements() {
const videoContainer = document.getElementById('videoContainer');
const embeds = videoContainer.querySelectorAll('.signbsldata-embed');
embeds.forEach(embed => {
// Remove all non-video elements
Array.from(embed.children).forEach(child => {
if (!child.querySelector('video')) {
child.style.display = 'none';
}
});
// Adjust the video element style if needed
const videoElem = embed.querySelector('video');
if (videoElem) {
videoElem.style.width = '100%';
}
});
}
function loadVideo(videoId) {
const videoContainer = document.getElementById('videoContainer');
videoContainer.innerHTML = `<blockquote class="signbsldata-embed" data-vidref="${videoId}"></blockquote>`;
// Reload the script to render the video
const script = document.createElement('script');
script.src = "https://embed.signbsl.com/widgets.js";
script.async = true;
script.onload = () => setTimeout(removeUnwantedElements, 2000); // Wait for the video to render before cleaning
document.body.appendChild(script);
}
function playNextVideo() {
if (currentVideoIndex < videos.length) {
loadVideo(videos[currentVideoIndex]);
currentVideoIndex++;
} else {
console.log('All videos played.');
}
}
playNextVideo(); // Play the first video
// Optionally, set up an interval or event listener to play the next video
setInterval(() => {
playNextVideo();
}, 10000); // Change 10000 to the length of each video in milliseconds
});
/*
document.addEventListener('DOMContentLoaded', function() {
const videos = [
'bmffabtttc', 'gilpbn5szf', 'nhy18vfspa', 'islnti0all', 'i4ovggtyvx'
];
let currentVideoIndex = 0;
function loadVideo(videoId) {
const videoContainer = document.getElementById('videoContainer');
videoContainer.innerHTML = `<blockquote class="signbsldata-embed" data-vidref="${videoId}"></blockquote>`;
// Reload the script to render the video
const script = document.createElement('script');
script.src = "https://embed.signbsl.com/widgets.js";
script.async = true;
document.body.appendChild(script);
}
function playNextVideo() {
if (currentVideoIndex < videos.length) {
loadVideo(videos[currentVideoIndex]);
currentVideoIndex++;
} else {
console.log('All videos played.');
}
}
playNextVideo(); // Play the first video
// Optionally, set up an interval or event listener to play the next video
setInterval(() => {
playNextVideo();
}, 10000); // Change 10000 to the length of each video in milliseconds
});
*/