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

audio-player-es6

v1.0.8

Published

html5 audio player

Downloads

4

Readme

Audio player

html5 audio player

  npm install audio-player-es6 --save

logs

  v1.0.4  Fri Nov 04 2016 12:38:34 GMT+0800 (中国标准时间)  add array.includes method
  v1.0.2  Tue Nov 01 2016 10:50:17 GMT+0800 (中国标准时间)  npm publish

support

support

exports

  if(typeof exports === 'object' && typeof module === 'object')
    module.exports = factory();
  else if(typeof define === 'function' && define.amd)
    define([], factory);
  else if(typeof exports === 'object')
    exports["Player"] = factory();
  else
    root["Player"] = factory();

import

   import Player from 'audio-player-es6';
   //or
   let Player = require('audio-player-es6');
   //or
   let player = new Player({})

#parameters

   audioList         播放列表         
   audioCurrentIndex 当前播放第几首
   lastPlayIndex     上一首id
   audioCurrent      播放Audio
   state             播放状态
   playDir           播放方向
   errorArray        错误歌曲列表
   abortTime         加载超时时间
   abortHandler      超时事件句柄
   volumeCurrent     声音音量
   auto              自动播放
   eventHandler      事件句柄
   mode              播放模式
   callback          歌曲各个阶段的回调函数对象

interface

2.1 src(source)

add music to player list

  player.src([]) || player.src('music.mp3')

2.2 play(n)

play

  play.play() || play.play(1) //  1 <= n <= list.length 

2.3 next()

player next music

  player.next()

2.4 pre()

player pre music

  player.pre()

2.5 jump(n)

n = index - current

 player.jump(1)   0 <= current+n < list.length

2.6 pause()

stop play

 player.pause()

2.7 other

  setMode(mode)
  setAuto(auto)
  setAbortTime(abortTime)
  setCallBack(callbackObj)
  runCallBack(name)
  setVolume(val)
  setAudioCurrentIndex(n)
  setErrorAudio()
  getErrorAudio(source)
  getStep()
  reload()
  audioPlay()
  reVolume()
  loading()
  reState(state)
  reDir(dir)
  reAbort()
  addEvent()
  filerErrorAudio()
  removeEevent()

usage

demo: https://github.com/Yi-love/audio-player-es6-demo

	var audio = new Player();
	audio.src(['/music/1.mp3','/music/2.mp3','/music/5.mp3','/music/4.mp3'])
	.src('hjk.mpg').src('/music/3.mp3').src('/music/4.mp3')
	.setCallBack({
		loading: function(state , player){
			console.log(state);
			document.getElementById('current').innerHTML = player.audioList[player.audioCurrentIndex]
		},
		playing:function(state , player){
			console.log(state, player.audioCurrentIndex , player.audioList[player.audioCurrentIndex])
		},
		end:function(state , player ){
			console.log(state)
		},
		abort: function(state , player){
			console.log(state , player.lastPlayIndex , player.audioList[player.lastPlayIndex])
		}
	}).play();

test

cmd

 webpack