Giter Site home page Giter Site logo

Comments (3)

Lehren avatar Lehren commented on August 12, 2024

First of all audioContext.close() returns a Promise. So setting the recorder to null and all subsequent actions will have to be done asynchronously.

Second of all why is it neccesary to close the resource? By unmounting and mounting you mean to stop the recording of audio, do some things (like changing the page) and resuming the audio recording?
In which case audioContext.suspend() and audioContext.resume() work just fine. They too return Promises.

from itslanguage-js.

joggienl avatar joggienl commented on August 12, 2024

First of all audioContext.close() returns a Promise. So setting the recorder to null and all subsequent actions will have to be done asynchronously.

I think you refer to the code example, I did notice it returns a promise. I was just demonstrating things could be done. In practice you would indeed put it in the promise or use async/await.

Second of all why is it neccesary to close the resource?

Because not closing results in error messages when you set AudioRecorder to null. Especially if you have an single-page-application. Hardware resources are still claimed to be in use (e.g. they are not freed up). The close function should free that resources. Note that Edge has Garbage Collection that does free up the resource by default (other browsers don't).

By unmounting and mounting you mean to stop the recording of audio, do some things (like changing the page) and resuming the audio recording?
In which case audioContext.suspend() and audioContext.resume() work just fine. They too return Promises.

I meant mount/un-mounting of a React component. These are stateless in simple form and proper cleanup of resources becomes important this way. Also due to the single-page-application that most React apps use.

From consumer point of view (the react app) I don't want to call audioContext features at all. If, for example, the SDK would manage a singleton instance or something like that for the audioContext and does a suspend/resume: would be fine.

Nevertheless I think it would be great to have a kind of cleanup function for the recorder.

from itslanguage-js.

joggienl avatar joggienl commented on August 12, 2024

closing this one because I think it is not relevant atm.

from itslanguage-js.

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.