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' );