# Error handling The Wowza Flowplayer iOS SDK provides a long list of callbacks for monitoring the player's state. Error callbacks are part of this list, but, in many cases, they may require special handling. ## Localized error messages There are errors that may not interrupt the content playback (eg. ad-related errors), but there are cases where the playback will be interrupted. In these cases, if you use the built-in controls, a meaningful message will be presented to the user together with a reload button. You can change these messages or provide translations to languages other than English by overriding the following string keys in your target's `Localizable.strings`: ```swift // An error related to the playback has occurred. "flowplayer-error-playback" = "Failed to play media."; // The access token could not be validated and therefore the playback cannot start. "flowplayer-error-access-token" = "Failed to validate access token."; // Failed to load a Flowplayer config. "flowplayer-error-config" = "Failed to load media."; // Failed to load the built-in controls. This probably happened due to poor or no Internet connection. "flowplayer-error-controls" = "Failed to load built-in controls."; // This message will actually not be shown to the user since the playback will not be interrupted. The message will be included in the error callback though. "flowplayer-error-ad" = "Failed to load ad."; // This actually should not happen but it works as a fallback in case some other (really) unexpected error has occurred. "flowplayer-error-unknown" = "An unknown error has occurred."; ``` If you wish to force a locale programmatically and override the default system language, then the simplest solution is to update the `UserDefaults`. The following example will force the local to French (Canada). ```swift // Note that you need to use an underscore (_) and not a dash (-). UserDefaults.standard.set(["fr_CA"], forKey: "AppleLanguages") UserDefaults.standard.synchronize() ``` Alternatively, you can write the following extension: ```swift extension Bundle { private static var bundle: Bundle! public static func setLanguage(lang: String) { UserDefaults.standard.set(lang, forKey: "app_lang") let path = Bundle.main.path(forResource: lang, ofType: "lproj") bundle = Bundle(path: path!) } } ``` Then use it like this: ```swift // Note that you need to use a dash (-) and not an underscore (_). Bundle.setLanguage(lang: "fr-CA") ``` Regardless of which of the two alternatives you choose to use, you still need to override Wowza Flowplayer's string keys in your target's `Localizable.strings` as was mentioned at the top of this section. ## Reload player Finally, if the playback has been interrupted, you may want to reload the player without having to call `prepare()` again. This can be achieved by calling: ```swift flowplayerViewController.reload() ```