korbav / wave.js-typescript Goto Github PK
View Code? Open in Web Editor NEWTemporary repository, please see https://github.com/foobar404/Wave.js.git instead
Temporary repository, please see https://github.com/foobar404/Wave.js.git instead
I'm not that familiar with typescript. Is there a way to change visualizer options?
I want to close the rendered path.
Hello @korbav. Thank you for such a great rewriting this library to typescript. Quite some time I see you active and even helping people with issues on original Wave.js :) The first time I looked at this rewritten lib a few months ago and it was really cool.
I have a few questions ant would be nice to talk(my discord nickname: Valerka#2430 , telegram: @valerii15298), because i really liked it and wanna start use it in my project.
There some things to improve:
Bug is that memoization isn't done, - it works just for one value. The same probem exist in original library but you seem to be active so I'm writing to your repo issues.
stream.toString()
will always return the same string [object MediaStream]
, line 39, file from-stream.ts if (!sources[stream.toString()]) {
. So better would be use stream.id as it is unique. Also using any in typescript is bad practice, if you see in this same file audioCtx is not initialised when (!sources[stream.toString()]) returns false. Then audioCtx.close().then() will throw error because of audioCtx will be undefined. This exactly what happend in my app using your lib, and thats why any
from typescript coud avoid this bug if useing proper type. If disable memoization it will work good. Also when put correct types we typescript shows us that line analyser.fftsize = 32768;
must be analyser.fftSize = 32768;
and thus helping us with proper autocomplite, available properties, etc ...
Also using global properties on window object is not very good practice. I didnot dive in code fully but for now i can say it doesnt need memoization on global window. From user point of use i dont wanna side effects, so when I invoke deactivate all data must be cleaned. If we still need memizaition(though i think we dont) then we need change all stream.toString() to stream.id.
``hi, i have problem when i want to stop and restart fromStream() function. whenever I deactivate() . and it doesn't work again after using WaveJS.fromStream() again. how can i solve this.
`function start() {
navigator.mediaDevices.getUserMedia({
audio: true,
}).then((mediaStream) => {
stream = mediaStream
const {deactivate} = WaveJS.fromStream(
stream,
"canvas",
{
type: "fireworks",
colors: ["white"]
}
, {connectDestination: false}
)
deactivate_wave = deactivate
})
}
function stop() {
deactivate_wave()
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.