3.0.3 • Published 5 years ago

ember-cli-recorderjs v3.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

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

ember-cli-recorderjs

Simple Wrapper around Recorder JS.

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-recorderjs

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.stopRecording() 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();
			recorder.close(); // Cloase audio context
		}
	}
});
<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.

3.0.3

5 years ago

3.0.2

5 years ago

3.0.1

5 years ago

2.0.2

6 years ago

2.0.1

6 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago