Class IAudioController


  • public class IAudioController
    extends java.lang.Object
    An IAudio controller to control play, stop, pause, and some status with the given audio instance.

    Note: this class is not thread-safe, so when it's used in multi-threading environment, the developer should handle the threading issue.

    Author:
    katherine
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int END  
      static int PAUSE  
      static int PLAY  
      static int STOP  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      IAudio build()
      Returns the immutable audio instance that the controller to build with.
      boolean isEnded()
      Return whether the audio is ended.
      boolean isPaused()
      Return whether the audio is paused.
      boolean isPlaying()
      Return whether the audio is playing.
      boolean isStopped()
      Return whether the audio is stopped.
      static IAudioController of​(IAudio owner)
      Returns the controller instance with the given audio
      void pause()
      Pauses the audio at the client.
      void play()
      Plays the audio at the client.
      void stop()
      Stops the audio at the client.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • play

        public void play()
        Plays the audio at the client.
      • stop

        public void stop()
        Stops the audio at the client.
      • pause

        public void pause()
        Pauses the audio at the client.
      • of

        public static IAudioController of​(IAudio owner)
        Returns the controller instance with the given audio
        Parameters:
        owner - The controller to control with
      • build

        public IAudio build()
        Returns the immutable audio instance that the controller to build with.
      • isPlaying

        public boolean isPlaying()
        Return whether the audio is playing.
        Returns:
        true if audio is playing;
      • isPaused

        public boolean isPaused()
        Return whether the audio is paused.
        Returns:
        true if audio is paused;
      • isStopped

        public boolean isStopped()
        Return whether the audio is stopped. While the audio is ended, also means it is stopped.
        Returns:
        true if audio is stopped or ended;
      • isEnded

        public boolean isEnded()
        Return whether the audio is ended.
        Returns:
        true if audio is ended;