a bit of progress on the player

This commit is contained in:
janis
2023-10-31 09:26:01 +01:00
parent c9687d7406
commit 1dbc816382
2 changed files with 25 additions and 1 deletions

View File

@@ -6,7 +6,8 @@ createApp( {
return {
hasLoaded: false,
songs: {},
playingSong: {}
playingSong: {},
isPlaying: false,
};
},
methods: {

View File

@@ -181,6 +181,29 @@ export default {
}
}, 300 );
},
sendUpdate( update ) {
let data = {};
if ( update === 'pos' ) {
data = this.playbackPos;
} else if ( update === 'playingSong' ) {
data = this.playingSong;
} else if ( update === 'songQueue' ) {
data = this.playbackPos;
} else if ( update === 'pos' ) {
data = this.playbackPos;
}
let fetchOptions = {
method: 'post',
body: JSON.stringify( { 'type': update, 'data': data } ),
headers: {
'Content-Type': 'application/json',
'charset': 'utf-8'
},
};
fetch( '/statusUpdate', fetchOptions ).then( res => {
} );
},
control( action ) {
// https://css-tricks.com/lets-create-a-custom-audio-player/
let musicPlayer = document.getElementById( 'music-player' );