New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@liripeng/vue-audio-player

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@liripeng/vue-audio-player

适用于PC移动端的 Vue 音频播放器组件

  • 0.1.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.7K
decreased by-9.1%
Maintainers
1
Weekly downloads
 
Created
Source

Vue音频播放器组件

线上演示

image

特性

  • 经过童星汇APP线上业务检验的组件
  • 完善的文档和示例
  • 支持进度条拖拽(PC 端需引入一个库模拟 Touch 事件,库链接:https://github.com/hammerjs/touchemulator)

安装

npm i -S @liripeng/vue-audio-player

注意事项

组件CSS使用 less 预编译语言

按需引入

import { AudioPlayer } from '@liripeng/vue-audio-player'
import '@liripeng/vue-audio-player/lib/vue-audio-player.css'

components: {
  AudioPlayer
}

全局引入

import AudioPlayer from '@liripeng/vue-audio-player'
import '@liripeng/vue-audio-player/lib/vue-audio-player.css'

Vue.use(AudioPlayer)

使用

<template>
  <div>
    <AudioPlayer :audio-list="audioList" />
  </div>
</template>

<script>
import { AudioPlayer } from '@liripeng/vue-audio-player'

export default {
  components: {
    AudioPlayer
  },
  data() {
    return {
      audioList: [
        'http://txh-cdn.96qbhy.com/20180817175211dtC1vE3z.mp3',
        'http://txh-cdn.96qbhy.com/20181106105737sOcozMqw.mp3'
      ]
    }
  }
}
</script>

Props

参数说明类型默认值
audio-list音频播放列表Array-
show-play-button是否显示播放按钮Booleantrue
show-prev-button是否显示上一首按钮Booleantrue
show-next-button是否显示下一首按钮Booleantrue
show-progress-bar是否显示进度条Booleantrue
isLoop是否列表循环播放Booleantrue
before-play播放前的回调函数
调用 done() 后开始播放
(done)=>void-
before-prev上一首前的回调函数
调用 done() 后开始播放上一首
(done)=>void-
before-next下一首前的回调函数
调用 done() 后开始播放下一首
(done)=>void-

Event

事件说明回调
timeupdate正在播放音频中触发event
loadedmetadata当媒介元素的持续时间以及其它媒介已加载数据时运行脚本触发event
ended音频播放结束后触发event

Data

变量说明默认值
currentPlayIndex当前播放的音频索引0
isPlaying音频是否正在播放false
duration音频持续时间-
currentTime音频当前播放时间-

更多请自行查看组件 data

Methods

方法说明回调
play开始播放-
pause暂停播放-
playPrev播放上一首-
playNext播放下一首-

更多请自行查看组件 methods

LICENSE

MIT

最后

使用过程中发现任何问题都可以提 Issue,也非常欢迎提PR

Keywords

FAQs

Package last updated on 10 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc