public Flowplayer
Flowplayer's skeleton. This interface contains all the public functions of the player.
Modifier and Type | Method and Description |
---|---|
void |
addEventListener(EventListener listener)
Adds an event listener.
|
long |
getCurrentPosition()
Returns the player's current position (in seconds).
|
long |
getDuration()
Returns the current media's duration (in seconds).
|
Flowplayer.State |
getPlaybackState()
Returns the player's current playback state.
|
boolean |
getUseControls()
Returns true if the player is set to use the built-in controls. False, otherwise. The default value is true.
|
boolean |
isFullscreen()
Returns true if the player is currently in fullscreen. False, otherwise.
|
void |
mute(boolean state)
Tells the player to mute or unmute.
|
void |
pause()
Tells the player to pause the playback. If the player is not yet ready, then the playback will remain paused after the player is prepared.
|
void |
play()
Tells the player to start the playback. If the player is not yet ready, then the playback will start as soon the player is prepared.
|
void |
prepare(FlowplayerVideo video,
boolean autoStart)
Prepares the player with a
class FlowplayerVideo . |
void |
prepare(ExternalVideo video,
boolean autoStart)
Prepares the player with a
class ExternalVideo . |
void |
reload()
If the player was previously prepared but the playback has stopped unexpected, calling this method will try to prepare the player again with the
previously specified video.
|
void |
removeEventListener(EventListener listener)
Removes a previously added event listener.
|
void |
seek(long position)
Tells the player to seek to a new position.
|
void |
setControlConfig(PlayerControlConfig config)
Sets optional control configurations. Build config using
class PlayerControlConfig.Builder . |
void |
setFullscreen(boolean fullscreen)
Toggles the player's fullscreen state. The result is also affected by whether
setFullscreenControlOrientation is set to true (by default it is true).
If setFullscreenControlOrientation is set to true and setFullscreen is called, then the device's orientation will automatically change to
landscape for fullscreen and to portrait for non-fullscreen. |
void |
setFullscreen(boolean fullscreen,
java.lang.Integer requestedOrientation)
Toggles the player's fullscreen state.
|
void |
setFullscreenControlOrientation(boolean controlOrientation)
Tells the player whether or not toggling the fullscreen state should also change the device's orientation.
|
void |
setFullscreenManager(FullscreenManager manager)
Sets a custom
interface FullscreenManager to dictate how fullscreen should handled. |
void |
setSpeed(float speed)
Sets a new playback speed.
|
void |
setUseControls(boolean useControls)
Tells the player whether or not it should use the built-in controls
|
void |
setVolume(float volume)
Adjusts volume.
|
void |
stop()
Tells the player to stop the playback. This will reset the player and in order to start playback again, the player needs to be again prepared.
|
void setControlConfig(@NotNull PlayerControlConfig config)
Sets optional control configurations. Build config using class PlayerControlConfig.Builder
.
config
- Contains information about optional control features.class PlayerControlConfig.Builder
void prepare(@NotNull FlowplayerVideo video, boolean autoStart)
Prepares the player with a class FlowplayerVideo
.
video
- Contains information about the media to be played.autoStart
- If true, the playback will start automatically as soon as the player is prepared. The default is true.class FlowplayerVideo
void prepare(@NotNull ExternalVideo video, boolean autoStart)
Prepares the player with a class ExternalVideo
.
video
- Contains information about the media to be played.autoStart
- If true, the playback will start automatically as soon as the player is prepared. The default is true.class ExternalVideo
void reload()
If the player was previously prepared but the playback has stopped unexpected, calling this method will try to prepare the player again with the previously specified video.
void play()
Tells the player to start the playback. If the player is not yet ready, then the playback will start as soon the player is prepared.
void pause()
Tells the player to pause the playback. If the player is not yet ready, then the playback will remain paused after the player is prepared.
void stop()
Tells the player to stop the playback. This will reset the player and in order to start playback again, the player needs to be again prepared.
void mute(boolean state)
Tells the player to mute or unmute.
state
- True to mute the player, false to bring it back to the system volume.void setVolume(float volume)
Adjusts volume.
volume
- Volume level in scale 0.0f - 1.0f.void setSpeed(float speed)
Sets a new playback speed.
speed
- The factor by which playback will be sped up. Must be greater than zero.void seek(long position)
Tells the player to seek to a new position.
position
- The position (in seconds) to which the player should seek.long getDuration()
Returns the current media's duration (in seconds).
long getCurrentPosition()
Returns the player's current position (in seconds).
@NotNull Flowplayer.State getPlaybackState()
Returns the player's current playback state.
boolean isFullscreen()
Returns true if the player is currently in fullscreen. False, otherwise.
void setFullscreen(boolean fullscreen)
Toggles the player's fullscreen state. The result is also affected by whether setFullscreenControlOrientation
is set to true (by default it is true).
If setFullscreenControlOrientation
is set to true and setFullscreen
is called, then the device's orientation will automatically change to
landscape for fullscreen and to portrait for non-fullscreen.
If setFullscreenControlOrientation
is set to false, then the device's orientation will not be affected by the player's fullscreen state changes.
fullscreen
- True to enter fullscreen, false to exit.setFullscreenControlOrientation
,
setFullscreenControlOrientation
,
setFullscreen
,
setFullscreenControlOrientation
void setFullscreen(boolean fullscreen, @Nullable java.lang.Integer requestedOrientation)
Toggles the player's fullscreen state.
fullscreen
- True to enter fullscreen, false to exit.requestedOrientation
- If set, it will request the activity to change to the specified orientation. Should be one of orientation values defined in android.content.pm.ActivityInfo.void setFullscreenManager(@NotNull FullscreenManager manager)
Sets a custom interface FullscreenManager
to dictate how fullscreen should handled.
interface FullscreenManager
void setFullscreenControlOrientation(boolean controlOrientation)
Tells the player whether or not toggling the fullscreen state should also change the device's orientation.
controlOrientation
- If true, the activity that contains the player will be rotated to landscape every time the player enters fullscreenand to portrait every time the player exits fullscreen. If set to false, the activity's orientation will not be affected by the player's fullscreen state.The default value is true.void setUseControls(boolean useControls)
Tells the player whether or not it should use the built-in controls
useControls
- If true, the player will use the built-in controls. Otherwise, no controls will be shown automatically. The default value is true.boolean getUseControls()
Returns true if the player is set to use the built-in controls. False, otherwise. The default value is true.
void addEventListener(@NotNull EventListener listener)
Adds an event listener.
void removeEventListener(@NotNull EventListener listener)
Removes a previously added event listener.