java.lang.Object | ||
↳ | org.ocast.core.DataStream | |
↳ | org.ocast.core.media.MediaController |
A dedicated DataStream
that manages media control like playing a
video, audio or loading picture
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
interface | MediaController.MediaControllerListener | Provides informations on playback status (position, playing,...) and metadata (title, tracks,...) |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
MediaController(MediaController.MediaControllerListener listener)
Instanciate a MediaController
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
getMetadata(Consumer<Metadata> onSuccess, Consumer<Throwable> onFailure)
Gets current media metadata.
| ||||||||||
void |
getPlaybackStatus(Consumer<PlaybackStatus> onSuccess, Consumer<Throwable> onFailure)
Gets current media status.
| ||||||||||
void |
mute(boolean enable, Runnable onSuccess, Consumer<Throwable> onFailure)
Mute the current playback
| ||||||||||
void |
onMessage(JSONObject message)
Subclass must implement this method to manage incoming messages
| ||||||||||
void |
pause(Runnable onSuccess, Consumer<Throwable> onFailure)
Pauses the current media playback
| ||||||||||
void |
play(double position, Runnable onSuccess, Consumer<Throwable> onFailure)
Plays the current media from a given position
| ||||||||||
void |
prepare(PrepareCommand command, Runnable onSuccess, Consumer<Throwable> onFailure)
Prepare a media playback
| ||||||||||
void |
resume(Runnable onSuccess, Consumer<Throwable> onFailure)
Resumes the current media playback
| ||||||||||
void |
seek(double position, Runnable onSuccess, Consumer<Throwable> onFailure)
Seeks the current media to a given position
| ||||||||||
void |
stop(Runnable onSuccess, Consumer<Throwable> onFailure)
Stops the current media playback
| ||||||||||
void |
track(Track track, Runnable onSuccess, Consumer<Throwable> onFailure)
enable or disable media
Track track | ||||||||||
void |
volume(double level, Runnable onSuccess, Consumer<Throwable> onFailure)
Sets the volume level
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.ocast.core.DataStream
| |||||||||||
From class
java.lang.Object
|
Instanciate a MediaController
listener | the listener to be notified of metadata and playback status updates |
---|
Gets current media metadata.
onSuccess | to be called on success with the Metadata |
---|---|
onFailure | to be called on error |
Gets current media status.
onSuccess | to be called on success with the PlaybackStatus |
---|
Mute the current playback
enable | true to mute, false to unmute |
---|
Subclass must implement this method to manage incoming messages
message | the incoming message |
---|
Pauses the current media playback
Plays the current media from a given position
position | the position expressed as seconds since start |
---|
Prepare a media playback
command | the data representing the media to be casted. |
---|---|
onSuccess | to be called in case of success. |
onFailure | to be called in case of error |
Resumes the current media playback
Seeks the current media to a given position
position | the position expressed as seconds since start |
---|
Stops the current media playback
enable or disable media Track
track
track | the track information |
---|
Sets the volume level
level | a value in a [0..1] interval |
---|