Package org.zkoss.stateless.state
Class IAudioController
- java.lang.Object
-
- org.zkoss.stateless.state.IAudioController
-
public class IAudioController extends java.lang.Object
AnIAudio
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
-
-
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 givenaudio
void
pause()
Pauses the audio at the client.void
play()
Plays the audio at the client.void
stop()
Stops the audio at the client.
-
-
-
Field Detail
-
STOP
public static final int STOP
- See Also:
- Constant Field Values
-
PLAY
public static final int PLAY
- See Also:
- Constant Field Values
-
PAUSE
public static final int PAUSE
- See Also:
- Constant Field Values
-
END
public static final int END
- See Also:
- Constant Field Values
-
-
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 givenaudio
- 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;
-
-