# @dw/d-audio

> d-audio

Latest version **1.0.21** (published 2019-03-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install @dw/d-audio
pnpm add @dw/d-audio
yarn add @dw/d-audio
bun add @dw/d-audio
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.21 |
| Published | 2019-03-13 |
| First published | 2019-03-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 2.6 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | daiwei |
| Maintainers | ifmiss |
| Keywords | audio, d-audio, music |

## Links

- npm: https://www.npmjs.com/package/@dw/d-audio
- Repository: https://github.com/ifmiss/d-audio.js
- Homepage: https://github.com/ifmiss/d-audio.js#readme
- Issues: https://github.com/ifmiss/d-audio.js/issues
- npm.io page: https://npm.io/package/@dw/d-audio

## Dependencies (2)

- [node-sass](https://npm.io/package/node-sass.md) ^4.11.0
- [node-vibrant](https://npm.io/package/node-vibrant.md) ^3.2.0-alpha

## Recent versions

- 1.0.21 (latest) — 2019-03-13

## README

# d-audio

插件演示地址: http://www.daiwei.org/components/d-audio <br>

播放器接入hexo博客: http://www.daiwei.org/hexo-blog

## 使用者:
http://fm.zkbhj.com/#carousel-example-generic

简洁的音乐播放器插件

![](https://github.com/IFmiss/music/blob/master/es5/img/TlPtuyzEtc.gif)

## 新版本d-audio上线
- 新增进度条随封面背景变化而变化

![](https://user-images.githubusercontent.com/17402583/52839950-b8cbca80-3132-11e9-8842-9ff64c4f26a9.png)

### 食用方法
安装：
```js
  npm install d-audio
```

引入

```js
import dAudio from 'd-audio'
const d = new dAudio ({
    ele: '#d-audio',
    src: '地址',
    imageurl: '地址',
    name: '音乐名字',
    singer: '歌手名字',
    next: function () {},
    ended: function () {}
})
```

es5安装：
如果不再es6环境下的代码，可以引入该项目根目录的lib文件夹下，引入js和css即可

```html
<!DOCTYPE html>
  <html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="http://daiwei.org/components/d-audio/lib/d-audio.css">
    <title>d-audio</title>
  </head>
  <body>
    <div class="d-audio" style="width: 300px;"></div>
  </body>
  <script src="http://daiwei.org/components/d-audio/lib/d-audio.js"></script>
  <script>
    var myAudio = new Daudio({
      ele: '.d-audio',
      ...
    })
  </script>
  </html>
```

### 参数

```js
// 音乐append的元素
ele: '#d-audio',

// 音乐封面
imageurl: 'http://www.daiwei.org/sunmmer.jpg',

// 音乐地址
src: '',

// 音乐名字
name: '',

// 音乐歌手
singer: '',

// 是否显示进度信息
showprogress: true,

// '' 就是默认状态， cricle则是初始化就是圆形且可以旋转
initstate: '',

// 是否循环
loop: false,

// 音乐播放结束事件，可设置播放下一首音乐
ended: () => {},

// 音乐下一曲的点击事件触发，需要配合checkAudio体现切歌的效果
next: () => {}
```

### 实例化对象方法

```js
// 显示loading
d.showLoading()

// 隐藏loading
d.hideLoading()

// 播放
d.play()

// 暂停
d.pause()

// 播放暂停
d.playPause()

// 切歌曲 播放下一首  音频地址，封面地址，名字，歌手
d.checkAudio(src, imageurl, name, singer)
```

---
_Source: https://npm.io/package/@dw/d-audio · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
