18 Star 121 Fork 33

会PS的小码农 / vue-aplayer for electron-vue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Vue-APlayer

Vue-APlayer

fork star

Vue implementation of APlayer prototype. Demo

Screenshot

特性

  • Beautiful clean UI
  • Lyrics scroll
  • Playlist with repeat & shuffle controls
  • Custom theme color / Self-adapting theme color
  • Drag and place anywhere
  • Mutex play
  • HLS support
  • Easy props and API
  • Dependency free and light-weight (gzipped 16KB)

Using Vue-APlayer in your project? Let me know!

运行时要求

使用

<aplayer autoplay
  :music="{
    title: 'secret base~君がくれたもの~',
    artist: 'Silent Siren',
    src: 'https://cn-east-17-aplayer-35525609.oss.dogecdn.com/secretbase.mp3',
    pic: 'https://cn-east-17-aplayer-35525609.oss.dogecdn.com/secretbase.jpg'
  }"
/>

以下方法只是实现思路,仅供参考

<!--下面是electron使用方法,该方法需要node fs支持-->
<aplayer autoplay ref="player" theme="pic" repeat="list" showLrc :narrow="false" :music="music" :list="music_list" />

<script>
    import { remote } from "electron";
    import path from "path";
    const fs = require("fs");
    import VueAplayer from "vue-aplayer";
    export default {
        name: "index",
        components: {
            //别忘了引入组件
            aplayer: VueAplayer
        },
        data() {
            return {
                music_list: [],
                music: {
                    // title: "王菲 - 红豆",
                    // src: "file:/home/edison/Music/王菲 - 红豆.mp3",
                    // lrc: "file:/home/edison/Music/王菲 - 红豆.lrc",
                    // artist: "王菲",
                    // pic: "file:/home/edison/Music/王菲 - 红豆.jpg"
                },
            }
        },
        created: function() {
            this.onload_music()
        },
        methods: {
            onload_music() {
                //获取歌词和图片等
                let resources = (basename, ext) => {
                    return new Promise((resolve, reject) => {
                        let res_path = path.join(music_path, basename + "." + ext);
                        fs.exists(res_path, exists => {
                            if (exists) {
                                resolve("file:" + res_path);
                            } else {
                                resolve(false);
                            }
                        });
                    });
                };
                //自动获取 ~/Music 目录下的所有音乐
                let music_path = path.join(remote.app.getPath("music"));
                //使用fs遍历目录
                fs.readdir(music_path, (err, files) => {
                    if (err) throw err;
                    //写入数组
                    let basename = path.basename(fPath).split(".")[0];
                    music = {
                        title: basename,
                        src: "file:" + fPath,
                        mus_id: md5(fPath),

                        artist: basename.split("-")[0].trim()
                    };
                    let lrc = await resources(basename, "lrc");
                    let pic =
                        (await resources(basename, "jpg")) ||
                        (await resources(basename, "png"));

                    if (lrc) {
                        music.lrc = lrc;
                    }
                    if (pic) {
                        music.pic = pic;
                    }

                    this.music_list.unshift(music);
                })
            }
        }
    }
</script>
// ES6
import Aplayer from 'vue-aplayer'

new Vue({
    components: {
        Aplayer
    }
})

开发者参考文档

贡献

如果你有好建议或则发现bug请 点这里提交

来历

-Vue-APlayer名称应该用完全相同的大小写。 -版本Vue-APlayer@1.x (github)或vue-aplayer@1.x(npm)。

相关项目

鸣谢

@DIYgod, for creating APlayer and sharing cloud storage for hosting Vue-APlayer's demo page media resources.

版权

Vue-APlayer 使用 MIT版权.

Copyright (c) 2016-present Shenghao "Doma" Lei Copyright (c) 2020-present EdisonLiu_

开发

使用npm/cnpm开发

npm install
npm run dev

使用 Yarn 开发

yarn
yarn run dev

测试地址 http://localhost:4000

排错

1.如下错误说明node没有使用11以上版本 An unexpected error occurred: "EPERM: operation not permitted, copyfile

MIT License Copyright (c) 2016-present Shenghao "Doma" Lei Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

github上一款比较好的vue音乐播放器,本人修改了其中一些地方,使其能兼容electron-vue。欢迎兄弟们提交优秀的源码 展开 收起
JavaScript 等 4 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/liushuai05/electron-vue-player.git
git@gitee.com:liushuai05/electron-vue-player.git
liushuai05
electron-vue-player
vue-aplayer for electron-vue
master

搜索帮助