Giter Club home page Giter Club logo

wave.js-typescript's People

Contributors

b-stud avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

valerii15298

wave.js-typescript's Issues

Method `fromStream` bug when memoized stream.

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.

in fromStream() deactivate() function does not work properly

``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()


}

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.