Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danielstorey/webrtc-audio-recording
This repository demonstrates how it is possible to record and playback audio in most modern browsers, and most notably - Safari 11 on both Mac and IOS.
https://github.com/danielstorey/webrtc-audio-recording
Last synced: 9 days ago
JSON representation
This repository demonstrates how it is possible to record and playback audio in most modern browsers, and most notably - Safari 11 on both Mac and IOS.
- Host: GitHub
- URL: https://github.com/danielstorey/webrtc-audio-recording
- Owner: danielstorey
- License: mit
- Created: 2017-10-03T17:08:54.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-21T20:12:12.000Z (over 6 years ago)
- Last Synced: 2024-08-01T13:34:04.165Z (3 months ago)
- Language: JavaScript
- Homepage: https://danielstorey.github.io/webrtc-audio-recording/
- Size: 12.7 KB
- Stars: 43
- Watchers: 9
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Audio Recording Using WebRTC
### **** Now deprecated. ****
For an easy to impliment reusable plugin please see
## [https://github.com/danielstorey/WebAudioTrack](https://github.com/danielstorey/WebAudioTrack)
This is a proof of concept demonstrating how it is possible to record and playback audio in most modern browsers, and most notably - Safari 11 on both Mac and IOS. This repo will not be updated any further but the demo will remain here as well as the notes below, containing crucial information for anyone wanting to work with the WebRTC API.
#### [Click here](https://danielstorey.github.io/webrtc-audio-recording/) for the demo
You can also serve and work on the files locally but please note this will not work unless the site is hosted using SSL (https://)
I have included Open SSL certificates for convenience and once you have installed the necessary modules via `npm install` you can simply run `node server` and open `https://localhost:3000` in your browser to view.
The most important thing to note about getting this to work in IOS is that the `AudioContext` must be created within an event handler and not within an automatically running script or a Promise. This is to do with the measures that Apple has put in place to prevent audio from automatically playing when you visit a site. So as long as you call `new AudioContext()` or `new webkitAudioContext()` from within an event handler you'll be fine.
The other thing to watch out for is to make sure that this context not 'garbage collected', otherwise the audio processor will stop with no error or warning. In this example I have created a `Storage` object in the global scope and assigned the `AudioContext` as a property of this object.
Finally I just want to say that much of my work on this has been based on, (and copied!) from [Muaz Khan's](https://github.com/muaz-khan) rather brilliant [RecordRTC](https://github.com/muaz-khan/RecordRTC) library, which includes video and gif recording as well.
This is simply a lightweight example of how recording audio can work and not necessarily a reusable library in its current state.