new LocalAudioTrack(mediaStreamTrack [, options])
Construct a LocalAudioTrack from a MediaStreamTrack.
Extends:
Parameters:
| Name | Type | Argument | Description | 
|---|---|---|---|
| mediaStreamTrack | MediaStreamTrack | An audio MediaStreamTrack | |
| options | LocalTrackOptions | <optional> | LocalTrack options | 
Properties:
| Name | Type | Description | 
|---|---|---|
| isStopped | boolean | Whether or not the LocalAudioTrack is stopped | 
Fires:
Extends
Members
Methods
- 
    attach()
- 
    
    Create an HTMLAudioElement and attach the AudioTrack to it. The HTMLAudioElement's srcObjectwill be set to a new MediaStream containing the AudioTrack's MediaStreamTrack.- Inherited From:
- Overrides:
 Returns:audioElement - Type
- HTMLAudioElement
 Exampleconst Video = require('twilio-video'); Video.createLocalAudioTrack().then(function(audioTrack) { const audioElement = audioTrack.attach(); document.body.appendChild(audioElement); });
- 
    detach()
- 
    
    Detach the AudioTrack from all previously attached HTMLMediaElements. - Inherited From:
- Overrides:
 Returns:mediaElements - Type
- Array.<HTMLMediaElement>
 Exampleconst mediaElements = audioTrack.detach(); mediaElements.forEach(mediaElement => mediaElement.remove()); 
- 
    disable()
- 
    
    Disable the LocalAudioTrack. This is effectively "mute". Fires:Returns:- Type
- this
 
- 
    enable( [enabled])
- 
    
    Enable or disable the LocalAudioTrack. This is effectively "unmute" or "mute". Parameters:Name Type Argument Description enabledboolean <optional> 
 Specify false to mute the LocalAudioTrack Fires:Returns:- Type
- this
 
- 
    enable()
- 
    
    Enable the LocalAudioTrack. This is effectively "unmute". Fires:Returns:- Type
- this
 
- 
    stop()
- 
    
    Calls stop on the underlying MediaStreamTrack. If you choose to stop a LocalAudioTrack, you should unpublish it after stopping. Fires:Returns:- Type
- this
 
Events
- 
    disabled
- 
    
    The AudioTrack was disabled, i.e. "muted". Parameters:Name Type Description trackAudioTrack The AudioTrack that was disabled - Inherited From:
- Overrides:
 
- 
    enabled
- 
    
    The AudioTrack was enabled, i.e. "unmuted". Parameters:Name Type Description trackAudioTrack The AudioTrack that was enabled - Inherited From:
- Overrides:
 
- 
    started
- 
    
    The AudioTrack started. This means there is enough audio data to begin playback. Parameters:Name Type Description trackAudioTrack The AudioTrack that started - Inherited From:
- Overrides: