mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 12:33:03 +00:00
more refactors
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user