Manage media playback

With the Wowza Flowplayer Apple SDK and integrated API, you can control and manage media playback from the player by using the properties and methods outlined on this page.

Properties allow you to work with events emitted by the player, so you can further manage media playback or configure the player within your iOS or tvOS application. The methods listed here allow you to perform specific actions to change the player and its behavior.

FlowplayerAPI

Applies to: iOS and tvOS

The FlowplayerAPI protocol is platform-agnostic. You can use it to create a custom video player interface while controlling and managing your playback in your iOS and tvOS applications. The protocol provides basic video controls and gives you access to the properties and methods outlined in this section.

Properties

Property Description
audioList Array containing all available audio tracks.
autoPlay Boolean that determines if media playback should start automatically. Set to false by default. If true, enables autoplay.
avPlayer Underlying AVPlayer instance. Returns nil if no player is available.
bufferLoadedPercentage Progress of the buffer loading, expressed as a percentage. Value of 0.0 indicates no buffer has been loaded. Value of 100.0 indicates that the entire buffer has loaded.
bufferState Current buffer state of the player. Keeps up with playback and indicates if the buffer is empty. You can observe this property using the player(_:didChangeBufferState:) delegate method or .flowplayerDidChangeBufferState property notification.
currentAudio Currently active audio track. Returns nil if no audio track if active.
currentSubtitle Currently active subtitle track. Returns nil if no subtitle track is active.
delegate Delegate to receive player events, such as playback state changes, errors, or metadata updates.
duration Duration of the current media. Returns nil if no media is loaded.
dvrWindow Current Digital Video Recorder (DVR) window information, including the start and end times of the available playback duration. Represents the portion of the content available for seeking and playback control. If the content is not DVR-enabled or the DVR window is unavailable, the DVRWindow object is nil.
id Unique identifier used to recognize a specific player instance. Can be set programmatically or randomly generated using the UUID format. Helpful when integrating multiple players within a view at the same time.
isMuted Boolean that indicates if the audio is muted.
isReady Indicates if the player is ready to perform certain actions, like play, pause, seek, etc. Set to true if the player is ready, and false otherwise. Can be used to control UI elements, like enabling or disabling play buttons based on the readiness of the player.
media Currently loaded media. Returns nil if no media is loaded. Use the load(_:) methods to set this value.
mediaHistoryList Stores all previously set media items. Doesn't store the current media item.
playbackState Current playback state of the player. Indicates if the playback started, ended, or is idle.
playbackStateList List that stores previously trigger playback states. First position captures the latest playback state change. When the state changes, the first position is updated and the list shifts to the end.
playbackType Current media playback type of the video player. To get the correct media playback type, check this value after the player has called the ready state.
position Current playback position of the media. Returns nil if no media is loaded.
preferredPeakBitRate Preferred peak bit rate for network playback. Returns nil if not set.
quality Presentation quality of the current media. Returns nil if no media is loaded.
rate Playback rate of the player. Ranges from -2.0 (reverse) to 2.0 (double speed).
sourceURL Represents the source URL for the media to be played by the player. Should point to a valid AVAsset, such as a video or audio file. If nil, there's no source URL set for the player. Before the player can begin playback, a valid media property must be provided.
state Current state of the player.
stateList List that stores previously triggered player states. First position captures the latest player state change. When the state changes, the first position is updated and the list shifts to the end.
subtitleList Array containing all available subtitle tracks.
volume Current volume of the player, with a range of 0.0 to 1.0.

Methods

load()
Description: Loads external media from a URL or file path.
Copy
Copied
func load(external media: MediaExternal)
Parameter Description
media Defines the external media source to load.
reload()
Description: Reloads current media and returns a boolean indicating success or failure. Allows to reset the playback state or update playback parameters. Returns a boolean value that indicates if the reload was successful.
Copy
Copied
func reload() -> Bool
pause()
Description: Pauses media playback.
Copy
Copied
func pause()
play()
Description: Starts or resumes media playback. If the playback is complete, then seeks back to the beginning and starts again.
Copy
Copied
func play()
stop()
Description: This method stops the currently playing media and allows the loading of new media. It should only be used when you need to abort the playback forcefully. When called, it emits the PlayerState/halted event from the player.
Copy
Copied
func stop()
seek()
Description: Seeks the player to a specified time within the content that's currently playing.
Copy
Copied
func seek(_ value: Double)
Parameter Description
value Defines the time to seek to, in seconds.
selectTrack(audio)
Description: Selects an audio track by ID.
Copy
Copied
func selectTrack(audio id: Int)
Parameter Description
id Defines the ID of the audio track to select.
selectTrack(subtitle)
Description: Selects a subtitle track by ID.
Copy
Copied
func selectTrack(subtitle id: Int)
Parameter Description
id Defines the ID of the subtitle track to select.

FlowplayerViewAPI

Applies to: iOS

The FlowplayerViewAPI protocol extends the FlowplayerAPI protocol, providing additional control over the player's appearance and behavior. However, it can only be used with your iOS applications to consume the player as a view. When using this protocol, you can access the following properties and methods.

Properties

Property Description
adDelegate FlowplayerAdDelegate object that should receive all Interactive Media Ad (IMA) events from the player.
controlsConfig Configuration object for the player's controls. Contains various properties to customize the appearance and behavior of the player controls. If nil, the player uses the default control configuration.
enableBackgroundPlayback Boolean value indicating if the player should continue playback when the app is in the background. If true, the player continues playing when the app is in the background. When false (default), the player pauses instead. To use this property correctly, make sure you support background playback inside your AppDelegate or SceneDelegate. See Playing Background Audio and Background playback for more.
fullscreenControlsOrientation Boolean value indicating if entering or exiting full-screen mode changes the device orientation. If true, entering full-screen mode changes the device orientation to landscape, while exiting full-screen mode changes the device orientation to portrait. When false, the player's full-screen mode doesn't affect device orientation.
hideControls Boolean value indicating if the player controls should be hidden (true). If false, the player controls are visible.
isFullscreen Boolean value indicating if the player is in full-screen mode. If true, player is in full-screen mode. If false, the player is in its normal mode.
orientation Current orientation of the device.
orientationControlsFullscreen Boolean value indicating if changing the device orientation should control full-screen mode. If true, rotating the device to the landscape orientation enters full-screen mode, while going back to landscape orientation exits full-screen mode. When false, device orientation doesn't affect the player's full-screen mode.
viewDelegate FlowplayerViewDelegate object that should receive view events.

Methods

openFullscreen()
Description: Changes the player to full-screen mode. If fullscreenControlsOrientation is true, the device orientation also changes to landscape.
Copy
Copied
func openFullscreen()
closeFullscreen()
Description: Exist full-screen mode, changing the player to its normal mode. If fullscreenControlsOrientation is true, the device orientation also changes to portrait.
Copy
Copied
func closeFullscreen()

FlowplayerManagerAPI

Applies to: tvOS

The FlowplayerManagerAPI protocol extends the FlowplayerAPI protocol, but only applies to the tvOS platform. It provides a player-manager, along with additional control over the player's behavior and support for managing Interactive Media Ad (IMA) content. When using this protocol, you have access to the properties in the following table.

Properties

Property Description
adDelegate FlowplayerAdDelegate object that should receive all Interactive Media Ad (IMA) events from the player.
info

Assign the delegate before playing any IMA ads to ensure that the delegate receives relevant events.