Comments (3)
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.
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.
closing this one because I think it is not relevant atm.
from itslanguage-js.
Related Issues (20)
- Document the release process
- Improve authentication export
- Enable usage of SpeechRecording
- Enhance the Audio Recorder
- Add Prettier HOT 1
- Build examples
- Remove browerify and babelify from Karma HOT 1
- Use multiple writes on recordings
- Implement feedback demo HOT 1
- Recorder uses wrong sample rate HOT 1
- Feedback: make sure to clean up registered functions
- StreamRecorderAudio: notify when ready to receive audio
- Progress getById groupId HOT 1
- TypeError: wssArgs is not iterable
- Refactor stream registration class HOT 1
- Feedback API: Don't send data if there is none
- Expand the Feedback API
- Check input bitrate
- Improve websocket connection
- Support backend pagination
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from itslanguage-js.