Tone.UserMedia
↳ EXTENDS Tone.AudioNodeTone.UserMedia uses MediaDevices.getUserMedia to open up and external microphone or audio input. Check MediaDevices API Support to see which browsers are supported. Access to an external input is limited to secure (HTTPS) connections.
DEFAULTS
EXAMPLE
Members
.deviceId
↝ String READONLY #Returns an identifier for the represented device that is persisted across sessions. It is un-guessable by other applications and unique to the origin of the calling application. It is reset when the user clears cookies (for Private Browsing, a different identifier is used that is not persisted across sessions). Returns undefined when the device is not open.
.groupId
↝ String READONLY #Returns a label describing this device (for example “Built-in Microphone”). Returns undefined when the device is not open or label is not available because of permissions.
.groupId
↝ String READONLY #Returns a group identifier. Two devices have the same group identifier if they belong to the same physical device. Returns undefined when the device is not open.
.state
↝ Tone.State READONLY #Returns the playback state of the source, “started” when the microphone is open and “stopped” when the mic is closed.
.context
↝ Tone.Context READONLY #Get the audio context belonging to this instance.
Methods
.open ( )
#The label or id of the audio input media device. With no argument, the default stream is opened.
The promise is resolved when the stream is open.
Open the media stream. If a string is passed in, it is assumed to be the label or id of the stream, if a number is passed in, it is the input number of the stream.
.connect ( )
#optionally which output to connect from
optionally which input to connect to
this
connect the output of a ToneNode to an AudioParam, AudioNode, or ToneNode
.disconnect ( )
#Either the output index to disconnect if the output is an array, or the node to disconnect from.
this
disconnect the output
.toMaster ( )
#this
Connect ‘this’ to the master output. Shorthand for this.connect(Tone.Master)