From 1dbc81638236be51ee9e1505f115f49bda511113 Mon Sep 17 00:00:00 2001 From: janis Date: Tue, 31 Oct 2023 09:26:01 +0100 Subject: [PATCH] a bit of progress on the player --- frontend/src/client/showcase.js | 3 ++- frontend/src/components/player.vue | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/frontend/src/client/showcase.js b/frontend/src/client/showcase.js index 66c985b..8065f3e 100644 --- a/frontend/src/client/showcase.js +++ b/frontend/src/client/showcase.js @@ -6,7 +6,8 @@ createApp( { return { hasLoaded: false, songs: {}, - playingSong: {} + playingSong: {}, + isPlaying: false, }; }, methods: { diff --git a/frontend/src/components/player.vue b/frontend/src/components/player.vue index 8c6de14..cf9592e 100644 --- a/frontend/src/components/player.vue +++ b/frontend/src/components/player.vue @@ -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' );