npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dw/wx-audio

v1.0.7

Published

wx-audio

Downloads

2

Readme

wx-audio

微信公众号音乐播放器

基于原生js写的一款仿微信公众号的音乐组件

演示地址

http://www.daiwei.org/components/wx-audio/

手机预览

安装

npm 安装

  npm install @dw/wx-audio

引入

  import WxAudio from '@dw/wx-audio/lib/wx-audio.css'
  import WxAudio from '@dw/wx-audio'

普通资源引入,先将es5文件下的目录放到自己的项目中,然后根据路径引入

<link href="./wx-audio.css" rel="stylesheet">
<script type="text/javascript" src="wx-audio.js"></script>

实例化 音乐组件

var wxAudio = new WxAudio({
  ele: '#textaudio1',
  title: '河山大好',
  disc: '许嵩',
  src: 'http://oiq8j9er1.bkt.clouddn.com/%E8%AE%B8%E5%B5%A9%20-%20%E6%B2%B3%E5%B1%B1%E5%A4%A7%E5%A5%BD1.mp3',
  width: '320px',
  autoplay: true,
  loop: true,
  ended: function () {
    alert('播放结束')
  }
});

属性

  • ele dom对象
  • title 音乐标题
  • disc 描述,可以当做显示歌手名称
  • src 地址
  • width 显示的宽度
  • loop 是否循环(当循环状态下时候,ended事件不会执行)
  • ended 方法,是一个回调,可在音乐播放结束之后执行其他的代码
  • autoplay 属性, 是否自动播放,这个只能在微信浏览器以及只设置静态src才能自动播放

方法

 // 实例化的wxAudio可以这样操作
wxAudio.audioPlay()   // 播放

wxAudio.audioPause()   // 暂停

wxAudio.audioPlayPause()  // 播放暂停

wxAudio.showLoading(bool)  //显示加载状态  参数bool
 
wxAudio.audioCut(src,title,disc)  实现音频切换的效果

新增 音乐组件切歌方法

通过实例化的wxAudio的audioCut(src,title,disc) 实现音频切换的效果  示例代码如下

  var src = 'http://oiq8j9er1.bkt.clouddn.com/%E6%9E%97%E4%BF%8A%E6%9D%B0%20-%20%E5%A5%B9%E8%AF%B41.mp3'
  var title = '她说'
  var disc = '林俊杰'
  wxAudio.audioCut(src, title, disc)