fixed player duration not updating correctly

This commit is contained in:
booploops 2021-12-03 01:06:29 -08:00
parent cb924ccaa3
commit eb912c5c5f
3 changed files with 79 additions and 50 deletions

View file

@ -19,6 +19,17 @@ Vue.component('mediaitem-list-item', {
}
});
const MusicKitTools = {
getHeader() {
return new Headers({
Authorization: 'Bearer ' + MusicKit.getInstance().developerToken,
Accept: 'application/json',
'Content-Type': 'application/json',
'Music-User-Token': '' + MusicKit.getInstance().musicUserToken
});
}
}
const app = new Vue({
el: "#app",
data: {
@ -29,13 +40,20 @@ const app = new Vue({
term: "",
results: {}
},
playerLCD: {
playbackDuration: 0
},
page: "browse"
},
methods: {
init() {
let self = this
this.mk = MusicKit.getInstance()
this.mk.authorize()
this.$forceUpdate()
this.mk.addEventListener(MusicKit.Events.playbackTimeDidChange, (a)=>{
self.playerLCD.playbackDuration = (self.mk.currentPlaybackTime)
})
},
showSearch() {
this.page = "search"