fix error when restarting player with same video

This commit is contained in:
simon 2021-12-18 17:15:53 +07:00
parent 88ebb6d648
commit bf0b07f3d7
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

View File

@ -349,7 +349,10 @@ function removePlayer() {
if (playerElement.hasChildNodes()) { if (playerElement.hasChildNodes()) {
var youtubeId = playerElement.childNodes[0].getAttribute("data-id"); var youtubeId = playerElement.childNodes[0].getAttribute("data-id");
var playedStatus = document.createDocumentFragment(); var playedStatus = document.createDocumentFragment();
playedStatus.appendChild(document.getElementById(youtubeId)); var playedBox = document.getElementById(youtubeId);
if (playedBox) {
playedStatus.appendChild(playedBox);
};
playerElement.innerHTML = ''; playerElement.innerHTML = '';
// append played status // append played status
var videoInfo = document.getElementById('video-info-' + youtubeId); var videoInfo = document.getElementById('video-info-' + youtubeId);