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

miniprogram-amr-player

v0.0.19

Published

微信小程序amr音频播放器(微信语音所用的格式)

Downloads

22

Readme

微信小程序AMR播放器

说明

  • 仅支持微信小程序
  • 安卓可以使用小程序中的wx.InnerAudioContext,支持amr格式,无需使用本方案
  • 可使用useWorker()配置多线程wx.Worker, 由于wx.Worker最大并发数量限制为1个,使用前需要保证其他worker已经结束,并保证app.json中配置好workers路径
  • 如使用url地址作为amr资源,需要将对应url域名增加到小程序白名单下,可参考微信小程序官方配置流程为wx.request增加域名白名单
  • npm包在小程序中引用需在小程序中构建, 详见小程序npm构建

安装

npm install miniprogram-amr-player

使用

加载并播放amr资源:

const AMRPlayer = require('miniprogram-amr-player/amrPlayer');
let armSrc;
AMRPlayer.loadWithUrl('https://test.com/test.amr').then((src) => {
    armSrc = src;
    armSrc.onPlay(() => {
        console.log('voice play');
    });
    armSrc.onEnded(() => {
        console.log('voice ended');
    });
    armSrc._onStop(() => {
        console.log('voice stopped');
    });
    ARMPlayer.play(amrSrc);
}, (err) => {
    console.err(err);
});

AMRPlayer.stop();

如果使用useWorker()开启多线程,则需要在小程序app.json中增加以下配置,并在app.json同级文件夹下创建workers目录,最后将构建好的miniprogram-amr-player/arm.min.js文件拷贝到workers目录中

{
    "workers": "workers"
}

许可

MIT.