Manage the player with the Wowza Flowplayer Android SDK

The Flowplayer interface is the core entry point to the Android SDK and integrated API. It provides definitions for the core listeners and main methods to control and manage media playback from the player.

State listeners

The StateListener interface fires when the internal state of the player changes. It accepts parameters for the previousState and currentState of the player. We support the different player states listed in the following table.

State Definition
BUFFERING The player can't play from its current position. Typically occurs when more data needs to be loaded.
COMPLETED The player has finished playing the media.
HALTED The player doesn't have any media to play because the stop() method was invoked.
IDLE The player doesn't have any media to play.
PAUSED The player can immediately play from its current position. It will start or resume playback when the play() method is called.
PLAYING The player is currently playing.

See the State reference documentation for additional details.

Methods

The Android SDK provides several functions and methods to interact with the player, to perform specific actions, and to change the player's behavior. Each method is listed in the following table. For a full reference and additional details about parameters and default settings, see the Flowplayer Functions reference documentation.

Method Description
addEventListener(args) Adds an event listener.
getCurrentPosition() Returns the player's current position (in seconds).
getDuration() Returns the current media's duration (in seconds).
getPlaybackState() Returns the player's current playback state.
getUseControls() Returns true (default) if the player is set to use the built-in controls. Otherwise, false.
hideControls(args) Tells the player whether or not it should hide the build-in controls.
isFullscreen() Returns true if the player is currently in full-screen mode. Otherwise, false.
mute(args) Tells the player to mute or unmute.
onPictureInPictureModeChanged(args) Handles changes in the host activity's or fragment's Picture-in-Picture (PiP) mode.
pause() Tells the player to pause the playback. If the player is not ready, then the playback remains paused after the player is prepared.
play() Tells the player to start the playback. If the player is not ready, then the playback starts as soon the player is prepared.
prepare(args) Prepares the player with an ExternalMedia or FlowplayerMedia, with autoStart set by default to true.
reload() If the player was previously prepared but the playback stopped unexpectedly, call this method to prepare the player again with the previously specified video.
removeEventListener(args) Removes a previously added event listener.
seek(args) Tells the player to seek to a new position.
setAudioTrack(args) Sets a new audio track.
setControlConfig(args) Sets optional control configurations. Build the configuration using the PlayerControlConfig.Builder class.
setFullscreen(args) Toggles the player's full-screen state.

The result is also affected by whether setFullscreenControlOrientation is set to true (default). If setFullscreenControlOrientation is set to true and setFullscreen is called, then the device's orientation automatically rotates to landscape when the player enters full-screen mode and to portait when the player exits full-screen mode.
setFullscreenControlOrientation(args) Tells the player whether or not toggling the full-screen state should also change the device's orientation.
setFullscreenManager(args) Sets a custom FullscreenManager interface to dictate how full-screen mode should handled.
setMediaNotificationTapIntent(args) Sets the android.app.PendingIntent to be triggered when the user taps on the media notification.
setResizeMode(args) Sets the androidx.media3.ui.AspectRatioFrameLayout.ResizeMode.
setShouldPauseOnBackground(args) Sets the behavior of the video player when the host activity is paused.
setSpeed(args) Sets a new playback speed.
setSubtitleTrack(args) Sets a new subtitle track.
setUseControls(args) Tells the player whether or not it should use the built-in controls.
setVideoTrack(args) Sets a new video track.
setVolume(args) Adjusts the player's volume.
stop() Tells the player to stop the playback. This resets the player. To start playback again, the player needs to be prepared again.