Class AudioPlayerSendHandler

java.lang.Object
de.presti.ree6.audio.AudioPlayerSendHandler
All Implemented Interfaces:
net.dv8tion.jda.api.audio.AudioSendHandler

public class AudioPlayerSendHandler extends Object implements net.dv8tion.jda.api.audio.AudioSendHandler
This is a wrapper around AudioPlayer which makes it behave as an AudioSendHandler for JDA. As JDA calls canProvide before every call to provide20MsAudio(), we pull the frame in canProvide() and use the frame we already pulled in provide20MsAudio().
  • Constructor Details

    • AudioPlayerSendHandler

      public AudioPlayerSendHandler(lavalink.client.player.LavaplayerPlayerWrapper audioPlayer)
      Parameters:
      audioPlayer - Audio player to wrap.
  • Method Details

    • canProvide

      public boolean canProvide()
      Check if the AudioPlayer can provide Audio.
      Specified by:
      canProvide in interface net.dv8tion.jda.api.audio.AudioSendHandler
      Returns:
      true if audio was provided.
    • provide20MsAudio

      public ByteBuffer provide20MsAudio()
      Let the AudioPlayer provide a ByteBuffer of the Audio.
      Specified by:
      provide20MsAudio in interface net.dv8tion.jda.api.audio.AudioSendHandler
      Returns:
      the ByteBuffer.
    • isOpus

      public boolean isOpus()
      Check if it is using the Opus Audio Library.
      Specified by:
      isOpus in interface net.dv8tion.jda.api.audio.AudioSendHandler
      Returns:
      true, if yes.