How to use the music-metadata/lib.parseFile function in music-metadata

To help you get started, we’ve selected a few music-metadata examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github quantumkv / nighthawk / src / renderer / components / player / Details.tsx View on Github external
fetchAlbumArt = async (path: string) => {
        let model: IAudioMetadata = await parseFile(path);
        let img: IPicture[] | undefined = model.common.picture;
        if (img !== undefined) {
            let imgURL = window.URL.createObjectURL(
                new Blob([img[0].data], { type: `image/${img[0].format}` })
            );
            this.setState({ albumart: imgURL });
        } else {
            this.setState({ albumart: defaultAlbumArt });
        }
    };