Interface AudioPlayer
-
- All Implemented Interfaces:
public interface AudioPlayerAudio player used to play audio messages.
-
-
Method Summary
Modifier and Type Method Description abstract UnitonAudioStateChange(Integer hash, Function1<AudioState, Unit> func)Subscribing for audio state changes for the audio of the hash abstract UnitonProgressStateChange(Integer hash, Function1<ProgressData, Unit> func)Subscribing for progress changes for the audio of the hash. abstract UnitonSpeedChange(Integer hash, Function1<Float, Unit> func)Subscribing for speed changes for the audio of the hash. abstract UnitregisterTrack(String url, Integer hash, Integer position)abstract UnitclearTracks()abstract Unitprepare(String sourceUrl, Integer audioHash)abstract Unitplay(String sourceUrl, Integer audioHash)Plays an audio track with sourceUrl. abstract Unitpause()Pauses the current song. abstract Unitresume(Integer audioHash)abstract UnitresetAudio(Integer audioHash)abstract UnitseekTo(Integer msec, Integer hash)Seeks the audio track of the audio hash to the milli second position. abstract UnitstartSeek(Integer audioHash)Informs the player that seek has started. abstract UnitchangeSpeed()Changes the speed of reproduction. abstract FloatcurrentSpeed()Current speed of reproduction. abstract UnitremoveAudio(Integer audioHash)Removes the current audio form the reproduction queue and removes the listeners abstract UnitremoveAudios(List<Integer> audioHashList)Removes the current audios form the reproduction queue and removes the listeners abstract Unitdispose()Disposes the MediaPlayer and remove all audios. -
-
Method Detail
-
onAudioStateChange
abstract Unit onAudioStateChange(Integer hash, Function1<AudioState, Unit> func)
Subscribing for audio state changes for the audio of the hash
- Parameters:
hash- the identifier of the audio trackfunc- The listener of the AudioState change.
-
onProgressStateChange
abstract Unit onProgressStateChange(Integer hash, Function1<ProgressData, Unit> func)
Subscribing for progress changes for the audio of the hash. The progress is updated every 50ms
- Parameters:
hash- the identifier of the audio trackfunc- The listener of the ProgressData change.
-
onSpeedChange
abstract Unit onSpeedChange(Integer hash, Function1<Float, Unit> func)
Subscribing for speed changes for the audio of the hash.
- Parameters:
hash- the identifier of the audio trackfunc- The listener of the speed change.
-
registerTrack
abstract Unit registerTrack(String url, Integer hash, Integer position)
-
clearTracks
abstract Unit clearTracks()
-
play
abstract Unit play(String sourceUrl, Integer audioHash)
Plays an audio track with sourceUrl.
- Parameters:
sourceUrl- the URL of the audio track
-
resetAudio
abstract Unit resetAudio(Integer audioHash)
-
seekTo
abstract Unit seekTo(Integer msec, Integer hash)
Seeks the audio track of the audio hash to the milli second position. If the hash is the same of the current playing audio track, the current audio track pauses.
- Parameters:
msec- the position in milli seconds.hash- the identifier of the audio track
-
startSeek
abstract Unit startSeek(Integer audioHash)
Informs the player that seek has started. This can be used to pause the current audio track when seek starts.
-
changeSpeed
abstract Unit changeSpeed()
Changes the speed of reproduction. Options are 1x, 1.5x and 2x
-
currentSpeed
abstract Float currentSpeed()
Current speed of reproduction. Options are 1x, 1.5x and 2x
-
removeAudio
abstract Unit removeAudio(Integer audioHash)
Removes the current audio form the reproduction queue and removes the listeners
-
removeAudios
abstract Unit removeAudios(List<Integer> audioHashList)
Removes the current audios form the reproduction queue and removes the listeners
-
-
-
-