MicrophonePlugin
Extends:
Implements:
Visualize microphone input in a wavesurfer instance.
Example:
// es6
import MicrophonePlugin from 'wavesurfer.microphone.js';
// commonjs
var MicrophonePlugin = require('wavesurfer.microphone.js');
// if you are using <script> tags
var MicrophonePlugin = window.WaveSurfer.microphone;
// ... initialising wavesurfer with the plugin
var wavesurfer = WaveSurfer.create({
// wavesurfer options ...
plugins: [
MicrophonePlugin.create({
// plugin options ...
})
]
});
Static Method Summary
Static Public Methods | ||
public static |
create(params: MicrophonePluginParams): PluginDefinition Microphone plugin definition factory |
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public |
|
|
public |
browser: * |
|
public |
bufferSize: * |
|
public |
constraints: * |
|
public |
levelChecker: * |
|
public |
|
|
public |
|
|
public |
micContext: * |
|
public |
|
|
public |
|
|
public |
params: * |
|
public |
|
|
public |
|
|
public |
stream: * |
|
public |
wavesurfer: * |
Method Summary
Public Methods | ||
public |
connect() Connect the media sources that feed the visualization. |
|
public |
destroy() Destroy the microphone plugin. |
|
public |
Browser detector. |
|
public |
deviceError(code: string) Device error callback. |
|
public |
Disconnect the media sources that feed the visualization. |
|
public |
extractVersion(uastring: string, expr: string, pos: number): number Extract browser version out of the provided user agent string. |
|
public |
gotStream(stream: MediaStream) Audio input device is ready. |
|
public |
init() |
|
public |
pause() Pause visualization. |
|
public |
play() Play visualization. |
|
public |
reloadBuffer(event: object) Redraw the waveform. |
|
public |
start() Allow user to select audio input device, e.g. |
|
public |
stop() Stop the device stream and remove any remaining waveform drawing from the wavesurfer canvas. |
|
public |
Stop the device and the visualization. |
|
public |
Pause/resume visualization. |
Inherited Summary
From class Observer | ||
public |
handlers: * |
|
public |
Manually fire an event |
|
public |
on(event: string, fn: function): ListenerDescriptor Attach a handler function for an event. |
|
public |
once(event: string, handler: function): ListenerDescriptor Attach a handler to an event. |
|
public |
setDisabledEventEmissions(eventNames: string[]) Disable firing a list of events by name. |
since 4.0.0 |
public |
Remove an event handler. |
|
public |
unAll() Remove all event handlers. |
Static Public Methods
public static create(params: MicrophonePluginParams): PluginDefinition source
Microphone plugin definition factory
This function must be used to create a plugin definition which can be used by wavesurfer to correctly instantiate the plugin.
Params:
Name | Type | Attribute | Description |
params | MicrophonePluginParams | parameters use to initialise the plugin |
Public Constructors
Public Members
public browser: * source
public bufferSize: * source
public constraints: * source
public levelChecker: * source
public localAudioBuffer: * source
public mediaStreamSource: * source
public micContext: * source
public numberOfInputChannels: * source
public numberOfOutputChannels: * source
public params: * source
public reloadBufferFunction: * source
public stream: * source
public wavesurfer: * source
Public Methods
public deviceError(code: string) source
Device error callback.
Params:
Name | Type | Attribute | Description |
code | string | Error message |
public extractVersion(uastring: string, expr: string, pos: number): number source
Extract browser version out of the provided user agent string.
public gotStream(stream: MediaStream) source
Audio input device is ready.
Params:
Name | Type | Attribute | Description |
stream | MediaStream | The microphone's media stream. |
public init() source
public reloadBuffer(event: object) source
Redraw the waveform.
Params:
Name | Type | Attribute | Description |
event | object | Audioprocess event |
public start() source
Allow user to select audio input device, e.g. microphone, and start the visualization.
public stop() source
Stop the device stream and remove any remaining waveform drawing from the wavesurfer canvas.