nuxt-musicfyplayer 2.1.4 → 2.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/module.json +1 -1
- package/dist/runtime/components/MusicfyPlayer.vue +4 -9
- package/dist/runtime/utils/average-color.d.ts +1 -0
- package/dist/runtime/utils/average-color.js +6 -0
- package/dist/runtime/utils/mediaelement.d.ts +1 -1
- package/dist/runtime/utils/mediaelement.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -146,6 +146,7 @@ Check out the [🏀 Online playground](https://stackblitz.com/github/yizack/nuxt
|
|
146
146
|
|
147
147
|
## Credits
|
148
148
|
|
149
|
+
- Built based on [embeddable-music-player](https://github.com/Yizack/embeddable-music-player)
|
149
150
|
- Detect average color with [fast-average-color](https://github.com/fast-average-color/fast-average-color)
|
150
151
|
- Music player controls by [MediaElement.js](https://www.mediaelementjs.com/)
|
151
152
|
- [Nuxt](https://github.com/nuxt/nuxt), the JavaScript framework for creating SSR Vue applications and its [Module Author Guide](https://nuxt.com/docs/guide/going-further/modules)
|
package/dist/module.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<script setup>
|
2
|
-
import {
|
2
|
+
import { getImageAverageColor } from "./../utils/average-color";
|
3
3
|
import { onMounted, ref, useTemplateRef } from "#imports";
|
4
4
|
const props = defineProps({
|
5
5
|
config: {
|
@@ -21,14 +21,9 @@ const audio = useTemplateRef("audio");
|
|
21
21
|
const size = ref({ width: props.width, height: props.height });
|
22
22
|
const backgroundColor = ref();
|
23
23
|
if (import.meta.client && props.config.colorDetect) {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
img.onload = () => {
|
28
|
-
const fac = new FastAverageColor();
|
29
|
-
const color = fac.getColor(img);
|
30
|
-
backgroundColor.value = color ? color.rgba : void 0;
|
31
|
-
};
|
24
|
+
getImageAverageColor(props.config.imageSrc).then((color) => {
|
25
|
+
backgroundColor.value = color;
|
26
|
+
}).catch(console.error);
|
32
27
|
}
|
33
28
|
onMounted(async () => {
|
34
29
|
if (!audio.value) return;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const getImageAverageColor: (src: string) => Promise<string>;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import 'mediaelement/build/mediaelement-and-player.js';
|
1
|
+
import 'mediaelement/build/mediaelement-and-player.min.js';
|
2
2
|
import type { MediaElementPlayerOptions } from '../types/mediaelement.js';
|
3
3
|
export declare const mediaElementPlayer: (element: HTMLAudioElement, options: MediaElementPlayerOptions) => void;
|
package/package.json
CHANGED