我是播放的wav格式文件,发现在IOS手机上无法播放,加上type后就可以了
安装
npm i -S @liripeng/vue-audio-player
或
yarn add @liripeng/vue-audio-player
中文文档:https://npmmirror.com/package/@liripeng/vue-audio-player
引入
import AudioPlayer from '@liripeng/vue-audio-player'
//import引入的组件需要注入到对象中才能使用
components: { AudioPlayer },
控件代码
<audio-player ref="audioPlayer" :audio-list="[url]" type="audio/wav" :show-prev-button="false"
:show-next-button="false" :isLoop="false" theme-color="#ff2929" />
获取数据代码
getZyCallById(id).then(res => {
var blob = new Blob([res], { type: 'audio/wav' })
this.url = URL.createObjectURL(blob)
console.log('this.url', this.url);
}).finally(() => {
})