devotox/ember-cli-opus-recorder


License: MIT

Language: JavaScript


Ember Observer Score Build Status Coverage Status NPM Version NPM Downloads Dependency Status DevDependency Status Greenkeeper

ember-cli-opus-recorder

Simple Wrapper around Opus Recorder.

This provides a service that can be used to record, play, and export audio as a wav file, blob, or bas64 string.

DEMO

Installation

ember install ember-cli-opus-recorder

Usage

  • After running recorder.start()<Promise> you can then run recorder.getAudio() to get the wav file created

Options

  • recordingTime: (Default: 5000)
    • Set how long recording should be before automatically stopping
    • Note: If set to a falsey value you will need to call recorder.stop() manually
    • recorder.set('recordingTime', <time in milliseconds>)
import Route from '@ember/routing/route';

import { inject } from '@ember/service';

export default Route.extend({

	recorder: inject(),

	init() {
		this._super(...arguments);
		let recorder = this.get('recorder');
		recorder.set('recordingTime', 5000);
	},

	setupController(controller) {
		this._super(...arguments);
		let recorder = this.get('recorder');
		controller.set('recorder', recorder);
	},

	actions: {
		async record() {
			let recorder = this.get('recorder');
			await recorder.start();

			let { base64, audioURL, blob } = await recorder.getAudio();
			console.log(base64, audioURL, blob);
		},
		async play() {
			let recorder = this.get('recorder');
			recorder.play();
		},
		async stop() {
			let recorder = this.get('recorder');
			recorder.stop();
		}
	}
});
<div>
	Recording
	{{#if recorder.isRecording}}
		Started!!
	{{else}}
		Stopped
	{{/if}}
</div>
<br />

<button {{action 'record'}}>Record</button>
<button {{action 'play'}}>Play</button>
<button {{action 'stop'}}>Stop</button>

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

Project Statistics

Sourcerank 3
Repository Size 3.57 MB
Stars 1
Forks 1
Watchers 1
Open issues 3
Dependencies 1,973
Contributors 3
Tags 5
Created
Last updated
Last pushed

Top Contributors See all

dependabot-preview[bot] Devonte ember-tomster

Packages Referencing this Repo

ember-cli-opus-recorder
Audio Recording for ember applications
Latest release 3.0.2 - Updated - 1 stars

Recent Tags See all

v3.0.2 January 21, 2020
v3.0.1 January 21, 2020
v2.0.5 November 25, 2019
v2.0.4 March 11, 2019
v2.0.3 March 11, 2019

Something wrong with this page? Make a suggestion

Last synced: 2019-11-25 18:41:19 UTC

Login to resync this repository