Error handling

The Wowza Flowplayer Apple SDK provides the ability to track and handle errors, emitting them as events for delegates and through the NotificationCenter.

For a good user experience, you can listen to these error events and examine the error objects. You can then handle errors gracefully by implementing error-handling logic that makes your iOS or tvOS application more reliable and robust.

When working with this SDK, you can leverage the Ad Error, PlayerError, and Swift.Error error types.


AdError is a custom error type specific to ad-related issues in the Apple SDK. It's thrown for any issues triggered by ads, such as when ads are unavailable, ad loading fails, ads fail to display, or when there's an invalid ad request. This table includes ad error conditions to help with troubleshooting.

Error condition Description
adDisplayError Indicates an error during ad display.
adLoadFailed Indicates a failure to load an ad.
invalidAdRequest Indicates an invalid ad request.
noAdAvailable Indicates no ad is available to play.
noAvPlayerInstance Indicates there's no AVPlayer instance available for playback.

IMAMetadata object

The IMAMetadata struct is designed to capture information related to ad playback and errors in the context of Google's Interactive Media Ads (IMA) framework.

You can use this object with error events to understand what caused an underlying advertising error. For example, to get useful metadata about a current IMA instance, combine this object with the AdError type and pass it as an optional parameter to the player(_:didAdFailWith:for:with:) method. The Apple SDK only returns the IMAMetadata object when an error occurs with a particular ad.

To handle cases where an ad fails to load or display the ad type and IMA snapshot, see the FlowplayerAdDelegate method or the NotificationCenter.

The following table describes the properties you can use with the IMAMetadata object.

Properties Description
type The current type of metadata.
adBreakTime The current ad break time in seconds.
adRemainingSeconds The remaining ad display time in seconds.
adMuted A boolean flag indicating if the ads were muted or not.
adDurationSeconds The total duration of the ads in seconds.
adErrorReason The error reason if an ad error occurred.
adVastError The VAST (Video Ad Serving Template) error reason if applicable.
adVastErrorType The VAST error type if applicable.
adRequestLoadTime The total time required to load the ads in seconds.


PlayerError is a custom error type specific to player-related issues in the Apple SDK. It's thrown for any issues triggered by the player, such as invalid configuration, invalid access token, or general playback errors. This table includes player error conditions to help with troubleshooting.

Error condition Description
invalidConfig The player configuration is invalid.
invalidAccessToken The access token provided for authentication is invalid.
playbackError(_ error: Error) An error occurred during playback. Returns a Swift.Error as its argument.


Within the Apple SDK framework, we take advantage of the native Swift way of defining and handling errors using the Error protocol. See Swift error type for more information.