mirror of
https://github.com/IrosTheBeggar/mStream.git
synced 2025-10-27 07:31:02 +00:00
fix bug caused by script defer
This commit is contained in:
parent
b4a4e54405
commit
800a915455
@ -102,7 +102,7 @@ const VUEPLAYERCORE = (() => {
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<li v-on:click="goToSong($event)" class="pointer collection-item" v-bind:class="{ playing: (this.index === positionCache.val), playError: (this.songError && this.songError === true) }" >
|
||||
<li v-on:click="goToSong($event)" class="pointer collection-item" v-bind:class="{ playing: (this.index === positionCache.val), playError: (this.songError && this.songError === true) }" >
|
||||
<div class="playlist-text">{{ comtext }}</div>
|
||||
<a v-on:click.stop="downloadSong($event)" class="secondary-content">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 12v7H5v-7H3v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zm-6 .67l2.59-2.58L17 11.5l-5 5-5-5 1.41-1.41L11 12.67V3h2z"/></svg>
|
||||
|
||||
@ -31,55 +31,6 @@
|
||||
|
||||
<!-- mStream Player -->
|
||||
<script src="../assets/js/mstream.player.js"></script>
|
||||
<script defer src="../assets/js/mstream.vue.player.js"></script>
|
||||
|
||||
<!-- Boot Up App -->
|
||||
<script defer>
|
||||
// load the playlist
|
||||
sharedPlaylist.playlist.forEach(item => {
|
||||
const newSong = {
|
||||
url: `../media/${item}?token=${sharedPlaylist.token}`,
|
||||
filepath: item,
|
||||
authToken: sharedPlaylist.token,
|
||||
metadata: {}
|
||||
};
|
||||
|
||||
MSTREAMPLAYER.addSong(newSong, true);
|
||||
|
||||
fetch('../api/v1/db/metadata', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
'filepath': item,
|
||||
'token': sharedPlaylist.token
|
||||
})
|
||||
})
|
||||
.then(async (response) => {
|
||||
if (response.ok !== true) {
|
||||
throw new Error(response);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
// handle success
|
||||
if (data.metadata) {
|
||||
newSong.metadata = data.metadata;
|
||||
MSTREAMPLAYER.resetCurrentMetadata();
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
// TODO: Don't spam error messages when an entire playlist fails to load
|
||||
iziToast.warning({
|
||||
title: 'Metadata Lookup Failed',
|
||||
position: 'topCenter',
|
||||
timeout: 3500
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
.row-mod {
|
||||
margin-bottom: 0px !important;
|
||||
@ -215,4 +166,54 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="../assets/js/mstream.vue.player.js"></script>
|
||||
|
||||
<!-- Boot Up App -->
|
||||
<script>
|
||||
// load the playlist
|
||||
sharedPlaylist.playlist.forEach(item => {
|
||||
const newSong = {
|
||||
url: `../media/${item}?token=${sharedPlaylist.token}`,
|
||||
filepath: item,
|
||||
authToken: sharedPlaylist.token,
|
||||
metadata: {}
|
||||
};
|
||||
|
||||
MSTREAMPLAYER.addSong(newSong, true);
|
||||
|
||||
fetch('../api/v1/db/metadata', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
'filepath': item,
|
||||
'token': sharedPlaylist.token
|
||||
})
|
||||
})
|
||||
.then(async (response) => {
|
||||
if (response.ok !== true) {
|
||||
throw new Error(response);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
// handle success
|
||||
if (data.metadata) {
|
||||
newSong.metadata = data.metadata;
|
||||
MSTREAMPLAYER.resetCurrentMetadata();
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
// TODO: Don't spam error messages when an entire playlist fails to load
|
||||
iziToast.warning({
|
||||
title: 'Metadata Lookup Failed',
|
||||
position: 'topCenter',
|
||||
timeout: 3500
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
Loading…
Reference in New Issue
Block a user