From 5426c6f98d182f205c1e62340c0c7e8bee280bac Mon Sep 17 00:00:00 2001 From: Bobby Wibowo Date: Wed, 4 Nov 2020 00:21:55 +0700 Subject: [PATCH] Updated player.js --- src/js/player.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/js/player.js b/src/js/player.js index 4e6a505..81187e6 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -61,7 +61,7 @@ page.reloadVideo = () => { const src = `${page.uploadRoot}/${page.urlInput.value}` axios.head(src).then(response => { - if (response.status !== 200 && response.status !== 304) { + if (![200, 304].includes(response.status)) { page.toggleReloadBtn(true) return page.onAxiosError(response) } @@ -74,6 +74,8 @@ page.reloadVideo = () => { return swal('An error occurred!', 'The requested upload does not appear to be a media file.', 'error') } + page.urlIdentifier = page.urlInput.value + if (page.player) { page.player.dispose() page.videoContainer.innerHTML = '' @@ -112,14 +114,14 @@ page.reloadVideo = () => { page.player.seekButtons({ forward: 10, back: 10 }) if (page.titleFormat) { - document.title = page.titleFormat.replace(/%identifier%/g, page.urlInput.value) + document.title = page.titleFormat.replace(/%identifier%/g, page.urlIdentifier) } if (page.downloadBtn) { page.downloadBtn.setAttribute('href', src) } - window.history.pushState(null, null, page.urlPrefix + page.urlInput.value) + window.history.pushState(null, null, page.urlPrefix + page.urlIdentifier) page.toggleReloadBtn(true) }).catch(error => { page.toggleReloadBtn(true)