JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 33
  • Score
    100M100P100Q60897F
  • License BSD

a cli player based on node

Package Exports

  • player

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (player) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

logo player

基于nodejs的命令行播放器

如何安装

npm install player

如何使用

var player = require('player');

// 播放demo.mp3
var song = player.add( __dirname + '/demo.mp3');
var song2 = player.add( __dirname + '/demo2.mp3');

// 从url播放
var websong = player.add( 'http://mr4.douban.com/201307241505/dea5ad99cf4676846599982159ba1bd9/view/song/small/p1948904.mp3' )

// 马上播放demo.mp3
player.play(song,function(){
    console.log('done!')
});

// 按列表顺序播放
player.play([song,song2],function(){
    console.log('done!!!')
});

// 3秒后停止播放
setTimeout(function(){
    player.stop(song);
},3000);

戴上耳机,试试看:

$ git clone https://github.com/turingou/player.git
$ cd player
$ npm install
$ node ./demo/demo.js

Changelog

  • 0.0.4 新增从url播放的接口
  • 0.0.3 新增播放列表配置项