function clientJs() { const AUTO_REFRESH_TIME_VIDEO = 20000 * 60; const AUTO_REFRESH_TIME_IMAGE = 20000 * 1; iDiDListeners(); startVideo(); autoRefreshVideo(); autoRefreshImage(); function startVideo() { const videoPlayer = getVideo(); if (videoPlayer) { videoPlayer.currentTime = 0; videoPlayer.play(); } } function iDiDListeners() { window.iDiD.listenSlideStart(() => { startVideo(); }); window.iDiD.listenSlideStop(() => { setTimeout(function () { window.location.reload(); }, 1000); }); } function autoRefreshVideo() { if (getVideo()) { console.log('is video'); setTimeout(function () { window.location.reload(); }, AUTO_REFRESH_TIME_VIDEO); } } function autoRefreshImage() { if (!getVideo()) { console.log('is image'); setTimeout(function () { window.location.reload(); }, AUTO_REFRESH_TIME_IMAGE); } } function getElement(selector) { return document.querySelector(selector); } function getVideo() { const videoPlayer = getElement("#video-player"); return videoPlayer; } }