使用flv.js播放音乐穿件频谱
**需要先下载或引入flv.js
**
在这里插入代码片drawcanvas(url) {
this.$nextTick(() => {
const canvas = document.getElementsByClassName('canvas')[0];
const audioPlayer = document.createElement('audio');//创建audio音乐标签
this.flvPlayer = flv.createPlayer(//开始使用flv播放音频
{
type: 'flv',
url,//音频地址这里只要填写地址就好不本地还是url,http请求的
isLive: true,
hasVideo: false
},
{
fixAudioTimestampGap: false,
enableStashBuffer: false
}
);
this.flvPlayer.attachMediaElement(audioPlayer);
this.flvPlayer.load();
// audioPlayer.volume = 0;
// if (audioPlayer.paused) {