UNPKG

react-mic-record

Version:
19 lines (13 loc) 628 B
"use strict"; exports.__esModule = true; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var AudioPlayer = function AudioPlayer(audioElem, audioContext) { _classCallCheck(this, AudioPlayer); var audioCtx = audioContext.getAudioContext(); var analyser = audioContext.getAnalyser(); this.audioSource = audioCtx.createMediaElementSource(audioElem); this.audioSource.connect(analyser); analyser.connect(audioCtx.destination); }; exports.default = AudioPlayer; module.exports = exports["default"];