fix: bad redirection, double buttons, double reload
This commit is contained in:
parent
c4cf5f3306
commit
4801f8add0
1 changed files with 7 additions and 6 deletions
13
js/main.js
13
js/main.js
|
@ -60,8 +60,9 @@ const main = () => {
|
||||||
*/
|
*/
|
||||||
const removeButtons = (parentOfButtons) => {
|
const removeButtons = (parentOfButtons) => {
|
||||||
const buttons = parentOfButtons.getElementsByTagName("button");
|
const buttons = parentOfButtons.getElementsByTagName("button");
|
||||||
for (let index = 0; index < buttons.length; index++) {
|
console.log(buttons);
|
||||||
parentOfButtons.removeChild(buttons[index]);
|
while (buttons.length) {
|
||||||
|
parentOfButtons.removeChild(buttons[0]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -79,6 +80,10 @@ const updateVideo = (videoFolder, videosList, tree, source, videoId) => {
|
||||||
source.src = `${videoFolder}/${videosList[videoId][0]}.${videosList[videoId][1]}`;
|
source.src = `${videoFolder}/${videosList[videoId][0]}.${videosList[videoId][1]}`;
|
||||||
source.type = `video/${videosList[videoId][1]}`;
|
source.type = `video/${videosList[videoId][1]}`;
|
||||||
|
|
||||||
|
// Force the reload of the video
|
||||||
|
// TODO(enhancement): Keep previous volume
|
||||||
|
videoElement.load();
|
||||||
|
|
||||||
// Add buttons at the end of the video
|
// Add buttons at the end of the video
|
||||||
videoElement.addEventListener(
|
videoElement.addEventListener(
|
||||||
"ended",
|
"ended",
|
||||||
|
@ -123,8 +128,4 @@ const updateVideo = (videoFolder, videosList, tree, source, videoId) => {
|
||||||
},
|
},
|
||||||
{ once: true }
|
{ once: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
// Force the reload of the video
|
|
||||||
// TODO(enhancement): Keep previous volume
|
|
||||||
videoElement.load();
|
|
||||||
};
|
};
|
||||||
|
|
Reference in a new issue