Class LocalDataTrack

java.lang.Object
com.twilio.video.DataTrack
com.twilio.video.LocalDataTrack
All Implemented Interfaces:
Track

public class LocalDataTrack extends DataTrack
A data track represents a unidirectional data source that can be used to send messages to participants of a Room.
  • Method Details

    • create

      @Nullable public static LocalDataTrack create(@NonNull android.content.Context context)
      Creates a local data track with no name and DataTrackOptions.DEFAULT_DATA_TRACK_OPTIONS.
      Parameters:
      context - application context.
      Returns:
      local data track
    • create

      @Nullable public static LocalDataTrack create(@NonNull android.content.Context context, @Nullable DataTrackOptions dataTrackOptions)
      Creates a local data track with no name and provided data track options.
      Parameters:
      context - application context.
      dataTrackOptions - data track options.
      Returns:
      local data track.
    • send

      public void send(@NonNull ByteBuffer messageBuffer)
      Send binary message. The maximum amount of data that can be sent cross-platform in a single invocation of send() is 16KiB. You could possibly send more when both the sender and the receiver are on the same platform.
      Parameters:
      messageBuffer - binary message
      See Also:
    • send

      public void send(@NonNull String message)
      Send string message. The maximum amount of data that can be sent cross-platform in a single invocation of send() is 16KiB. You could possibly send more when both the sender and the receiver are on the same platform.
      Parameters:
      message - string message.
      See Also:
    • isEnabled

      public boolean isEnabled()
      Description copied from class: DataTrack
      Check if this data track is enabled.
      Specified by:
      isEnabled in interface Track
      Overrides:
      isEnabled in class DataTrack
      Returns:
      true if the track is enabled.
    • getName

      @NonNull public String getName()
      Returns the local data track name. A pseudo random string is returned if no track name was specified.
      Specified by:
      getName in interface Track
      Overrides:
      getName in class DataTrack
    • release

      public void release()
      Releases native memory owned by data track.