

Embed a simple HTML music player from local or hosted audio on your Nuxt app using MediaElement.js and fast-average-color
- Add
nuxt-musicfyplayer dependency to your project
pnpm add -D nuxt-musicfyplayer
yarn add --dev nuxt-musicfyplayer
npm install --save-dev nuxt-musicfyplayer
- Add
nuxt-musicfyplayer to the modules section of nuxt.config.ts
export default defineNuxtConfig({
modules: [
'nuxt-musicfyplayer'
]
})
That's it! You can now use nuxt-musicfyplayer in your Nuxt app
In the project, use the component <MusicfyPlayer :config="" />, where config is the configuration options of the player.
| Property |
Description |
Default value |
config |
MusicfyPlayer composable |
|
width |
Music player width |
100% |
height |
Music player height |
450px |
Define your configuration options with the useMusicfyPlayer composable.
| Property |
Description |
audio |
The audio source properties |
image |
The image source (preferably squared) |
color |
Color options |
| Property |
Description |
Default value |
provider |
Provider of the audio source. |
local |
type |
Content-type fo the audio source |
audio/mpeg |
preload |
Preload the audio source |
auto |
... |
Selected audio provider properties |
|
| Audio property |
Description |
Required |
src |
Audio source link |
Yes |
| Audio property |
Description |
Required |
id |
File identifier |
Yes |
rlkey |
New file identifier param |
No |
| Property |
Description |
Required |
src |
Image source link |
Yes |
alt |
Image alternative text |
No |
| Property |
Description |
Default value |
class |
A custom class for your player's background color |
musicfyplayer-color |
detect |
Detect the dominant color from the image source and use it as the player's background color |
false |
Use the useMusicfyPlayer composable to define the configuration options of the player.
<script setup lang="ts">
const config = useMusicfyPlayer({
audio: {
provider: "dropbox",
preload: "none",
id: "soep3xvq8aee4eh6hcj4r",
rlkey: "g7sqo9y5zl3f69oxftzo5auc5"
},
image: {
src: "https://dimatis.music/images/reminiscences.jpg",
alt: "Dimatis - Reminiscences"
},
color: {
detect: true
}
})
</script>
<template>
<MusicfyPlayer :config="config" width="100%" />
</template>
Example of use on a website: Dimatis Website


Check out the Online playground for more examples.
npm install
npm run dev:prepare
npm run dev
npm run dev:build
npm run lint
npm run test
npm run test:watch
npm run release