Giter Site home page Giter Site logo

Comments (10)

zhw2590582 avatar zhw2590582 commented on June 19, 2024

后端提供的wav接口,是指wav文件访问链接吗?你的wav文件大不大,不大的话可以加载完再生成波形图试试

var wf = new WFPlayer({
	container: document.querySelector("#waveform"),
});

fetch("path/to/audio.wav")
	.then((res) => res.buffer())
	.then((buffer) => new Uint8Array(buffer))
	.then((uint8Array) => wf.load(uint8Array));

from wfplayer.

bartflyian avatar bartflyian commented on June 19, 2024

后端提供一个wav文件流,目前是想边加载边生成波形

from wfplayer.

zhw2590582 avatar zhw2590582 commented on June 19, 2024

其实很难做到真正的边加载边生成波形的,因为这个库使用浏览器自带的AudioContext接口去解码音频,意味着每次解码必需是一个完整的可播放的音频(包含头部元信息),但假如你截取了一个音频的一部分(可能不包含头部元信息)去解码,AudioContext识别不出来这个是什么数据的。

from wfplayer.

bartflyian avatar bartflyian commented on June 19, 2024

嗯嗯,感谢你的回答

from wfplayer.

yuguaa avatar yuguaa commented on June 19, 2024

我想使用MP4加载波形,报错挺厉害的,不知道怎么处理
image

from wfplayer.

zhw2590582 avatar zhw2590582 commented on June 19, 2024

@yuguaa 你可以贴这个mp4的地址出来吗,我看看

from wfplayer.

yuguaa avatar yuguaa commented on June 19, 2024

@yuguaa 你可以贴这个mp4的地址出来吗,我看看

这个地址有公司的信息,不太方便,是mp4格式,没有其他的要求,视频大小大概是400M

from wfplayer.

zhw2590582 avatar zhw2590582 commented on June 19, 2024

@yuguaa 这视频有点大,音频解码过程都会把浏览器卡死,你可以把视频转成mp3试试,首页有ffmpeg的教程

from wfplayer.

yuguaa avatar yuguaa commented on June 19, 2024

@yuguaa 这视频有点大,音频解码过程都会把浏览器卡死,你可以把视频转成mp3试试,首页有ffmpeg的教程

3q,我去看看

from wfplayer.

huanghaiyang avatar huanghaiyang commented on June 19, 2024

@yuguaa 这视频有点大,音频解码过程都会把浏览器卡死,你可以把视频转成mp3试试,首页有ffmpeg的教程

ffmpeg转码mp3需要的时间会更长~且ffmpeg本身体积有>20mb,光加载ffmpeg就得一分钟~~~

from wfplayer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.