Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
this is a vue-audio component overwrite from native audio tags
一个移动端的audio组件,自定义进度条,目前版本为0.1.0测试版本,初步解决了在ios以及andriod上的兼容问题。 npm引入:
npm install ch-audio
通过该属性传入音频地址。 本地音频请使用require()语法进行导入。
<ch-audio
:width="300"
audioSrc="require('./assets/111.mp3')"
:playimg="require('./assets/play.png')"
:stopimg="require('./assets/stop.png')"></ch-audio>
</div>
ios获取音频,尽量使用服务器接口流模式,请在后端设置相应的响应头,koa.js参考如下:
router.get('/getsource/:filename',async ctx=>{
console.log(ctx.params.filename);
var mp3 = path.resolve('./view/source/' + ctx.params.filename);
ctx.set({
'Content-Type': 'audio/mpeg',
'Content-Length': fs.statSync(mp3).size,
})
if (ctx.headers.range === 'bytes=0-1') { //ios音频预请求头,不处理则获取不到audio.duration
ctx.set('Content-Range', `bytes 0-1/${fs.statSync(mp3).size}`) // 重点在这
ctx.body = '1'
} else {
ctx.set({
'Accept-Ranges': 'bytes',
})
const src = fs.createReadStream(mp3)
ctx.body = src
}
});
目前可以自定义播放以及暂停按钮的样式,本地图片请使用require()语法进行导入 例如:
<template>
<div id="app">
<ch-audio
audioSrc="require('./assets/111.mp3')"
:playimg="require('./assets/play.png')"
:stopimg="require('./assets/stop.png')"></ch-audio>
</div>
</template>
可自定义宽度,通过width
传入,number类型。
<template>
<div id="app">
<ch-audio
:width="300"
audioSrc="require('./assets/111.mp3')"
:playimg="require('./assets/play.png')"
:stopimg="require('./assets/stop.png')"></ch-audio>
</div>
</template>
目前支持rem模式,通过props:rem:'true'
开启,开启后可使用rem;
例如:
<template>
<div id="app">
<ch-audio
:width="6"
:rem="true"
audioSrc="require('./assets/111.mp3')"
:playimg="require('./assets/play.png')"
:stopimg="require('./assets/stop.png')"></ch-audio>
</div>
</template>
FAQs
this is a vue-audio component overwrite from native audio tags
The npm package ch-audio receives a total of 1 weekly downloads. As such, ch-audio popularity was classified as not popular.
We found that ch-audio demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.