more refactors

This commit is contained in:
geoffrey45
2022-02-24 09:05:50 +03:00
parent 38df211882
commit ca790e97d9
10 changed files with 29 additions and 24 deletions
+3 -5
View File
@@ -14,8 +14,7 @@ const playing = ref(state.is_playing);
const url = "http://0.0.0.0:9876/file/";
const playAudio = (trackid) => {
const elem = document.getElementsByClassName('progress-bar')[0];
const bottom_elem = document.getElementsByClassName('progress-bar')[1];
const elem = document.getElementById('progress');
const full_path = url + encodeURIComponent(trackid);
@@ -32,11 +31,10 @@ const playAudio = (trackid) => {
);
audio.ontimeupdate = () => {
current_time.value = audio.currentTime;
pos.value = (audio.currentTime / audio.duration) * 1000;
pos.value = (audio.currentTime / audio.duration) * 100;
let bg_size = ((audio.currentTime / audio.duration) * 100)
elem.style.backgroundSize = `${bg_size}% 100%`;
bottom_elem.style.backgroundSize = `${bg_size}% 100%`;
};
})
.catch((err) => console.log(err));
@@ -54,7 +52,7 @@ function playPrev() {
}
function seek(position) {
audio.currentTime = (position / 1000) * audio.duration;
audio.currentTime = (position / 100) * audio.duration;
}
function playPause() {