import MediaLibraryDescriptorLoader from "./loader/MediaLibraryDescriptorLoader.js";

export default class Mediaplayer{
    #rootFolderHandler = null;
    #libraryDescriptor = null;

    async start(){
        try {
            this.#rootFolderHandler = await showDirectoryPicker({"id": "mediaplayer_amin", "mode": "readwrite"});
            this.#libraryDescriptor = await MediaLibraryDescriptorLoader.loadDescriptor(this.#rootFolderHandler);
            this.#initPlayer();
        } catch (error) {
            console.log("Unable to start media player!");
            console.error(error);
        }
    }

    #initPlayer(){
        //change ui to msg dialog "loading library ..."
        this.#loadPlaylists();
        //init ui
    }

    #loadPlaylists(){

    }
}