added search and play from search

This commit is contained in:
booploops 2021-12-02 22:24:58 -08:00
parent 56a475d904
commit 60f9f83c09
2 changed files with 102 additions and 29 deletions

View file

@ -3,7 +3,12 @@ var app = new Vue({
data: {
drawertest: false,
mk: {},
quickPlayQuery: ""
quickPlayQuery: "",
search: {
term: "",
results: {}
},
page: "browse"
},
methods: {
init() {
@ -11,6 +16,24 @@ var app = new Vue({
this.mk.authorize()
this.$forceUpdate()
},
showSearch() {
this.page = "search"
},
playMediaItemById(id, kind) {
this.mk.setQueue({ [kind]: [id] }).then(function (queue) {
MusicKit.getInstance().play()
})
},
searchQuery() {
let self = this
this.mk.api.search(this.search.term,
{
types: "songs,artists,albums,playlists",
limit: 32
}).then(function(results) {
self.search.results = results
})
},
mkReady() {
if(this.mk["nowPlayingItem"]) {
return true