Open larrywal opened 3 years ago
Peaks.init()
should always return. If there's an error, it should call the callback parameter with an Error
object. What combination of options are you passing to Peaks.init()
?
Thanks for the quick response! Here's the code I'm using. When I comment out the line
audio.current!.src = fileURL
then the code after init never seems to run.
Thanks. Currently, Peaks.init()
doesn't accept a mediaUrl
option, so - as you've found - you need to set the media element's src
attribute before calling Peaks.init()
.
I'll look into making Peaks.init()
more consistent with .setSource()
.
Got it - thanks much.
On Thu, Nov 12, 2020 at 9:12 AM Chris Needham notifications@github.com wrote:
Thanks. Currently, Peaks.init() doesn't accept a mediaUrl option, so - as you've found - you need to set the media element's src attribute before calling Peaks.init().
I'll look into making Peaks.init() more consistent with .setSource().
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bbc/peaks.js/issues/341#issuecomment-726213978, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKLRL4MUUACDF2PC5DN2XU3SPQJRTANCNFSM4TSYT7WQ .
Never seen this notation:
audio.current!.src = [...]
Trying to find documentation for that, but I fail. Is this correct? What do I have to search for, if I want to learn about this specific NOT notation?
It's a TypeScript feature: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-0.html#non-null-assertion-operator
Calling Peaks.init()
with an empty <audio>
element (i.e., no src
attribute and no <source>
elements), the callback is never invoked. See:
Hi - am trying to use peaks.js to generate waveforms on the fly using WebAudio. I notice that with SetSource I can pass just a mediaURL and webAudio.audioContext. But on init, I must pass a mediaElement that contains the fileURL as its src. Otherwise the init never seems to return. Is this expected behavior?