mirror of
https://github.com/janishutz/MusicPlayerV2.git
synced 2025-11-25 21:14:22 +00:00
some progress on player + playlist loading
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>Library</h1>
|
||||
<playlistsView></playlistsView>
|
||||
<playlistsView :playlists="$props.playlists"></playlistsView>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import playlistsView from '@/components/playlistsView.vue';
|
||||
|
||||
defineProps( {
|
||||
'playlists': {
|
||||
'default': [],
|
||||
'type': Array<any>,
|
||||
'required': true,
|
||||
}
|
||||
} );
|
||||
</script>
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
import { ref } from 'vue';
|
||||
import playlistView from '@/components/playlistView.vue';
|
||||
import MusicKitJSWrapper from '@/scripts/player';
|
||||
import MusicKitJSWrapper from '@/scripts/music-player';
|
||||
|
||||
const isPlaying = ref( false );
|
||||
const repeatMode = ref( '' );
|
||||
@@ -46,9 +46,9 @@
|
||||
isPlaying.value = !isPlaying.value;
|
||||
// TODO: Execute function on player
|
||||
if ( isPlaying.value ) {
|
||||
player.play();
|
||||
player.control( 'play' );
|
||||
} else {
|
||||
player.pause();
|
||||
player.control( 'pause' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,8 +85,28 @@
|
||||
}
|
||||
}
|
||||
|
||||
const getPlaylists = ( cb: ( data: object ) => void ) => {
|
||||
player.getUserPlaylists( cb );
|
||||
}
|
||||
|
||||
const logIntoAppleMusic = () => {
|
||||
player.logIn();
|
||||
}
|
||||
|
||||
const getAuth = (): boolean[] => {
|
||||
return player.getAuth();
|
||||
}
|
||||
|
||||
const skipLogin = () => {
|
||||
player.init();
|
||||
}
|
||||
|
||||
defineExpose( {
|
||||
logIntoAppleMusic,
|
||||
getPlaylists,
|
||||
controlUI,
|
||||
getAuth,
|
||||
skipLogin,
|
||||
} );
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
<template>
|
||||
<div>
|
||||
<h3>Your playlists</h3>
|
||||
<div v-for="pl in $props.playlists" v-bind:key="pl.id">
|
||||
{{ pl.attributes.name }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const props = defineProps( {
|
||||
'playlists': {
|
||||
'default': [],
|
||||
'type': Array<any>,
|
||||
'required': true,
|
||||
}
|
||||
} )
|
||||
</script>
|
||||
Reference in New Issue
Block a user