-
- All Implemented Interfaces:
-
com.twilio.video.Track
public class LocalAudioTrack extends AudioTrack
Represents a local audio source.
-
-
Method Summary
Modifier and Type Method Description static LocalAudioTrackcreate(@NonNull() Context context, boolean enabled)Creates an audio track. static LocalAudioTrackcreate(@NonNull() Context context, boolean enabled, @Nullable() AudioOptions audioOptions)Creates an audio track. static LocalAudioTrackcreate(@NonNull() Context context, boolean enabled, @Nullable() String name)Creates an audio track. static LocalAudioTrackcreate(@NonNull() Context context, boolean enabled, @Nullable() AudioOptions audioOptions, @Nullable() String name)Creates an audio track. synchronized booleanisEnabled()Check if the local audio track is enabled. StringgetName()Returns the local audio track name. synchronized voidenable(boolean enable)Sets the state of the local audio track. synchronized voidrelease()Releases native memory owned by audio track. synchronized voidaddSink(@NonNull() AudioSink audioSink)Adds a sink to the Track. synchronized voidremoveSink(@NonNull() AudioSink audioSink)Removes a sink from the Track. -
-
Method Detail
-
create
@Nullable() static LocalAudioTrack create(@NonNull() Context context, boolean enabled)
Creates an audio track. Note that the RECORD_AUDIO permission must be granted in order forthis operation to succeed. If RECORD_AUDIO is not granted null is returned.
- Parameters:
context- application context.enabled- initial state of audio track.
-
create
@Nullable() static LocalAudioTrack create(@NonNull() Context context, boolean enabled, @Nullable() AudioOptions audioOptions)
Creates an audio track. Note that the RECORD_AUDIO permission must be granted in order forthis operation to succeed. If RECORD_AUDIO is not granted null is returned.
- Parameters:
context- application context.enabled- initial state of audio track.audioOptions- audio options to be applied to the track.
-
create
@Nullable() static LocalAudioTrack create(@NonNull() Context context, boolean enabled, @Nullable() String name)
Creates an audio track. Note that the RECORD_AUDIO permission must be granted in order forthis operation to succeed. If RECORD_AUDIO is not granted null is returned.
- Parameters:
context- application context.enabled- initial state of audio track.name- audio track name.
-
create
@Nullable() static LocalAudioTrack create(@NonNull() Context context, boolean enabled, @Nullable() AudioOptions audioOptions, @Nullable() String name)
Creates an audio track. Note that the RECORD_AUDIO permission must be granted in order forthis operation to succeed. If RECORD_AUDIO is not granted null is returned.
- Parameters:
context- application context.enabled- initial state of audio track.audioOptions- audio options to be applied to track.name- audio track name.
-
isEnabled
synchronized boolean isEnabled()
Check if the local audio track is enabled.
When the value is false, the local audio track is muted. When the value is true the localaudio track is live.
-
getName
@NonNull() String getName()
Returns the local audio track name. A pseudo random string is returned if no track name wasspecified.
-
enable
synchronized void enable(boolean enable)
Sets the state of the local audio track. The results of this operation are signaled to otherParticipants in the same Room. When an audio track is disabled, the audio is muted.
- Parameters:
enable- the desired state of the local audio track.
-
release
synchronized void release()
Releases native memory owned by audio track.
-
addSink
synchronized void addSink(@NonNull() AudioSink audioSink)
Adds a sink to the Track. Sinks consume raw audio samples for further processing or storage.
-
removeSink
synchronized void removeSink(@NonNull() AudioSink audioSink)
Removes a sink from the Track.
- Parameters:
audioSink- An object that implements the `AudioSink` interface.
-
-
-
-