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

taro-background-audio

v1.2.0

Published

基于taro开发的背景音频播放组件,有问题联系[email protected]

Downloads

2

Readme

代码借鉴 taro-audio 开发的背景播放版本!!!

若需要小程序在退到后台后继续播放音频,你需要在 app.json 中配置 requiredBackgroundModes 属性,详见:微信小程序官方文档

代码演示

引入

    import TaroBackgroundAudio from 'taro-background-audio';

基础用法

通过src属性设置音频资源的地址

    <TaroBackgroundAudio src={'你的路径'}/>

lvruHP.png

显示音频名称

通过title属性显示音频名称

    <TaroBackgroundAudio src={'你的路径'} title='泡沫'/>

lvr39g.png

显示作者

通过singer属性显示音频作者

<TaroBackgroundAudio src={'你的路径'} title='泡沫' singer='邓紫棋'/>

lvr83Q.png

进度条是否可拖拽

通过draggable设置


 <TaroBackgroundAudio src={'你的路径'} title='泡沫' singer='邓紫棋' draggable={false}/>

lvrnBt.png

设置海报

通过coverImgUrl设置

<TaroBackgroundAudio src={'你的路径'} title='泡沫' singer='邓紫棋' draggable coverImgUrl={'你的路径'}/>

lxn3vj.png

Props

| 参数 | 说明 | 类型 | 默认值 | 是否必须 | |------|------|------|------|------| | src | 音频资源的地址 | string | 无 | 是 | | title | 音频名称 | string | 未知 | 否 | | singer | 音频作者 | string | 未知 | 否 | | coverImgUrl | 音频海报 | string | 无 | 否 | | autoPlay | 是否自动播放 | boolean | true | 否 | | loopPlay | 是否循环播放 | boolean | false | 否 | | draggable | 是否可以拖动进度条 | boolean | true | 否 | | onPlay | 当开始/继续播放时触发play事件 | eventHandle | 无 | 否 | onPause | 当暂停播放时触发 pause 事件 | eventHandle | 无 | 否 | onEnded | 当播放到末尾时触发 ended 事件 | eventHandle | 无 | 否 | onTimeUpdate | 当播放进度改变时触发 timeupdate 事件,detail = {currentTime, duration} | eventHandle | 无 | 否 | onError | 当发生错误时触发 error 事件,detail = {errMsg} | eventHandle | 无 | 否