katspaugh / wavesurfer.js

Audio waveform player
https://wavesurfer.xyz
BSD 3-Clause "New" or "Revised" License
8.86k stars 1.64k forks source link

AIFF Support #1644

Closed Stoyvo closed 5 years ago

Stoyvo commented 5 years ago

Wavesurfer.js version(s):

2.2.1

Browser and operating system version(s):

Chrome 73

Code needed to reproduce the issue:

Any example from website

Use behaviour needed to reproduce the issue:

Using an AIFF file (source is from Beatport), webaudio decodeArrayBuffer is throwing an error "Uncaught (in promise) DOMException"

From what I read online, WAV and AIF/AIFF are supported. I cannot find any information about incompatibility of decodeArrayBuffer and AIF/AIFF.

Nothing available in the Chrome bug list about AIFF either.

Any ideas as to what might cause this? Maybe size of arraybuffer? If we can identify the issue, it would be useful to document limitations and supported filetypes (same as Chromes I'd assume)

Edit: I just realized the file is 69.4 MB

thijstriemstra commented 5 years ago

From what I read online, WAV and AIF/AIFF are supported.

any links?

thijstriemstra commented 5 years ago

ping @Stoyvo

Stoyvo commented 5 years ago

Sorry @thijstriemstra this is actually related to filesize. WebAudio fails, the AIF file was huge and Chrome simply can't handle it. This issue will be closed

alexnitta commented 4 years ago

I'm seeing a similar error, but for a small .aiff file (402 kb). I see two errors in the console:

Uncaught Error: The error you provided does not contain a stack trace.

and:

DOMException: Unable to decode audio data

Perhaps this issue should be reopened, as it does not seem specific to large files?

marcelblum commented 4 years ago

Current Chrome doesn't support aif through the web audio api or html5 audio, nor does Firefox.

console.log(document.createElement('audio').canPlayType('audio/x-aiff'))
//""
console.log(MediaSource.isTypeSupported('audio/x-aiff'))
//false

Safari does though as Apple owns aif.

alexnitta commented 4 years ago

@marcelblum Good to know, thanks for clarifying. Perhaps this is worthy of including somewhere in https://wavesurfer-js.org so others will be aware when considering this library.

thijstriemstra commented 4 years ago

Perhaps this is worthy of including somewhere in https://wavesurfer-js.org so others will be aware when considering this library.

An online example on wavesurfer.js org that shows status of browser support, e.g. canPlayType('audio/x-aiff') and other mime-types, would be nice. Anyone want to make such an example?