Interface IPlayer


public interface IPlayer
Represents an audio player for a specific guild. Contains track data and is used for controlling playback.
  • Method Summary

    Modifier and Type Method Description
    com.sedmelluq.discord.lavaplayer.player.AudioPlayer getAudioPlayer()  
    long getGuildId()  
    ISocketContext getSocketContext()  
    com.sedmelluq.discord.lavaplayer.track.AudioTrack getTrack()  
    boolean isPlaying()  
    void play​(com.sedmelluq.discord.lavaplayer.track.AudioTrack track)  
    void seekTo​(long position)  
    void setPause​(boolean pause)  
    void setVolume​(int volume)  
    void stop()
    Stops playing the current track, if any
  • Method Details

    • getAudioPlayer

      com.sedmelluq.discord.lavaplayer.player.AudioPlayer getAudioPlayer()
      Returns:
      the underlying Lavaplayer player
    • getTrack

      @Nullable com.sedmelluq.discord.lavaplayer.track.AudioTrack getTrack()
      Returns:
      the player's current track which is either playing or paused. May be null
    • getGuildId

      long getGuildId()
      Returns:
      the guild which this player belongs to. Immutable
    • getSocketContext

      ISocketContext getSocketContext()
      Returns:
      the WebSocket this player belongs to
    • play

      void play​(com.sedmelluq.discord.lavaplayer.track.AudioTrack track)
      Parameters:
      track - the track to start playing, potentially replacing an existing one
    • stop

      void stop()
      Stops playing the current track, if any
    • setPause

      void setPause​(boolean pause)
      Parameters:
      pause - whether to pause or not
    • seekTo

      void seekTo​(long position)
      Parameters:
      position - the new position of the current track in milliseconds
      Throws:
      java.lang.RuntimeException - if not playing anything
    • setVolume

      void setVolume​(int volume)
      Parameters:
      volume - in percentage 0% to 1000%
    • isPlaying

      boolean isPlaying()
      Returns:
      Whether the player is trying to produce audio