io.agora.rtc

## Class AgoraMediaCtrlPacketSender

- java.lang.Object
- - io.agora.rtc.AgoraMediaCtrlPacketSender

-     public class AgoraMediaCtrlPacketSender
      extends java.lang.Object

  Wrapper for sending media control packets.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private long` | `cptr` Native pointer to the packet sender instance.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AgoraMediaCtrlPacketSender(long cptr)` Constructs a media control packet sender.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `destroy()` Destroys the packet sender and releases native resources.
    `private void` | `nativeDestroy(long cptr)` Releases the native packet sender handle.
    `int` | `sendBroadcast(byte[] packet, int length)` Sends a broadcast packet to all peers.
    `int` | `sendPeer(java.lang.String user_id, byte[] packet, int length)` Sends a packet to a specific peer.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### cptr

          private long cptr

      Native pointer to the packet sender instance.

  - ### Constructor Detail

    - #### AgoraMediaCtrlPacketSender

          public AgoraMediaCtrlPacketSender(long cptr)

      Constructs a media control packet sender.
      Parameters:
        `cptr` - Native pointer to the sender instance

  - ### Method Detail

    - #### sendPeer

          public int sendPeer(java.lang.String user_id,
                              byte[] packet,
                              int length)

      Sends a packet to a specific peer.
      Parameters:
        `user_id` - Target user ID
        `packet` - Packet data to send
        `length` - Length of the packet data
      Returns:
        0 on success, <0 on failure

    - #### sendBroadcast

          public int sendBroadcast(byte[] packet,
                                   int length)

      Sends a broadcast packet to all peers.
      Parameters:
        `packet` - Packet data to send
        `length` - Length of the packet data
      Returns:
        0 on success, <0 on failure

    - #### destroy

          public void destroy()

      Destroys the packet sender and releases native resources.

    - #### nativeDestroy

          private void nativeDestroy(long cptr)

      Releases the native packet sender handle.
      Parameters:
        `cptr` - Native pointer to the sender instance