mirror of
https://github.com/janishutz/MusicPlayer.git
synced 2026-09-10 14:25:24 +02:00
feat: add songs via Apple Music
This commit is contained in:
@@ -11,6 +11,12 @@ import type {
|
||||
import type {
|
||||
RepeatMode
|
||||
} from '../dtype/player';
|
||||
import {
|
||||
useLocalPlayer
|
||||
} from './plugins/local';
|
||||
import {
|
||||
useMusicKit
|
||||
} from './plugins/musickit';
|
||||
|
||||
export const sources: {
|
||||
[key: string]: PlayerSourcePlugin
|
||||
@@ -29,3 +35,19 @@ export const isPlaying = ref( false );
|
||||
export const shuffle = ref( false );
|
||||
|
||||
export const repeat: Ref<RepeatMode> = ref( 'off' );
|
||||
|
||||
const initSources = async () => {
|
||||
try {
|
||||
sources['applemusic'] = await useMusicKit();
|
||||
} catch {
|
||||
console.warn( 'MusicKitJS intialization failed' );
|
||||
}
|
||||
|
||||
try {
|
||||
sources['local'] = await useLocalPlayer();
|
||||
} catch {
|
||||
console.warn( 'Local Player intialization failed' );
|
||||
}
|
||||
};
|
||||
|
||||
initSources();
|
||||
|
||||
Reference in New Issue
Block a user