Tone.UserMedia
↳ EXTENDS ToneTone.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
//list the inputs and open the third one
var motu = new Tone.UserMedia();
//opening the input asks the user to activate their mic
motu.open().then(function(){
//opening is activates the microphone
//starting lets audio through
motu.start(10);
});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 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.
.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.
.state
↝ Tone.State READONLY #Returns the playback state of the source, “started” when the microphone is open and “stopped” when the mic is closed.
Methods
.enumerateDevices ( )
#The promise that is resolved with the devices
Returns a promise which resolves with the list of audio input devices available.
EXAMPLE
extInput.enumerateDevices().then(function(devices){
console.log(devices)
}).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.