Class 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 Detail

      • 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
                         java.nio.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:
        Understanding Message Size Limits
      • send

        public void send​(@NonNull
                         java.lang.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:
        Understanding Message Size Limits
      • 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 java.lang.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.