You can use a JSON object to define several player configuration settings. Using a JSON object to define player configuration settings offers several benefits:

  • **Maintenance**: Allows making player changes without resubmitting the app to the App Store

  • **Efficient Development**: Facilitates defining player configuration settings through a single builder method

  • **Caching**: Permits caching player configurations in memory or on a web server

<br />


ο»Ώ

## Load a JSON Configuration

Use the following steps to initialize a player with a JSON configuration:

  1. Define a JSON object.

    <table> <thead> <tr> <th> Format </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td width="40%"> <strong>data</strong> Data </td> <td width="60%"> Enables caching a data blob downloaded from your own web service and allows the iOS SDK to deserialize the JSON <br /><br /> This is a data blob that contains serialized JSON. Using this format removes the need for you to convert the Data to a JSONObject yourself. </td> </tr> <tr> <td> <strong>json</strong> [String : Any] </td> <td> Enables creating the JSON as a dictionary within the code </td> </tr> </tbody> </table>

<br />

  1. Through J`WPlayerConfigurationBuilder()`, load a JSON configuration to configure the player.

    ο»Ώ

<br />


ο»Ώ

## iOS Specific Properties

The iOS SDK has support for the following properties.

### (root)

<table> <thead> <tr> <th> Property </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td width="40%"> <strong>allowsBackgroundPlayback</strong> Bool </td> <td width="60"> Defines JWP VAST ads playback behavior when the app is in the background <br /><br /> <strong>Possible Values</strong>: <ul> <li><code>true</code>: JWP VAST ads are heard and continue playing while the app is in the background.</li> <li><code>false</code>: JWP VAST ads stop playing while the app is in the background.</li> </ul> </td> </tr> <tr> <td> <strong>externalMetadata</strong> [JSONObject] </td> <td> Defines external metadata to be triggered at a designated time <br /><br /> See: <a href="#externalmetadata">externalMetadata</a> object</td> </tr> <tr> <td> <strong>externalPlaybackSettings</strong> JSONObject </td> <td> Defines properties which change how external playback is affected with AirPlay devices <br /><br /> See: <a href="#externalplaybacksettings">externalPlaybackSettings</a> object</td> </tr> <tr> <td> <strong>locale</strong> String </td> <td> ISO 639-1 locale associated with the caption track </td> </tr> </tbody> </table>

<br /><br />

#### externalMetadata

<table> <thead> <tr> <th> Property </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td width="40%"> <strong>endTime<span style="color: red">*</span></strong> Double </td> <td width="60%"> End time of the cue, expressed as a number of seconds from the beginning of the content</td> </tr> <tr> <td> <strong>identifier<span style="color: red">*</span></strong> String </td> <td> Unique identifier used to represent the metadata cue</td> </tr> <tr> <td> <strong>startTime<span style="color: red">*</span></strong> Double </td> <td> Start time of the cue, expressed in seconds from the beginning of the content</td> </tr> </tbody> </table>

<br /><br />

#### externalPlaybackSettings

<table> <thead> <tr> <th> Format </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td width="40%"> <strong>playbackEnabled</strong> Bool </td> <td width="60%"> Indicates whether the player allows switching to external playback mode <br /><br /> See also: <a href="https://developer.apple.com/documentation/avfoundation/avplayer/1387441-allowsexternalplayback" target="_blank">allowsExternalPlayback</a> </td> </tr> <tr> <td> <strong>usesExternalPlaybackWhileExternalScreenIsActive</strong> Bool </td> <td> Indicates whether the player should automatically switch to external playback mode while the external screen mode is active <br /><br /> See also: <a href="https://developer.apple.com/documentation/avfoundation/avplayer/1624255-usesexternalplaybackwhileexterna/" target="_blank">usesExternalPlaybackWhileExternalScreenIsActive</a> </td> </tr> <tr> <td> <strong>videoGravity</strong> String </td> <td> Indicates how the layer displays video content within its bounds <br /><br /> <strong>Possible Values</strong>: <ul> <li><code>resize</code>: Stretches the video to fill the bounds of the layer</li> <li><code>resizeAspect</code>: Preserves the aspect ratio of the video and fits it within bounds of the layer</li> <li><code>resizeAspectFill</code>: Preserves the aspect ratio of the video and fills the bounds of the layer</li> </ul> <br /> See also: <a href="https://developer.apple.com/documentation/avfoundation/avcapturevideopreviewlayer/1386708-videogravity" target="_blank">videoGravity</a> </td> </tr> </tbody> </table>

<br /><br />

### Captions

The iOS SDK supports all <a href="https://docs.jwplayer.com/players/reference/captions-config-ref" target="_blank">captions</a> options.

<br />

<!-- Removes the automatic page-to-page navigation at the bottom of the page -->

<style> .rm-Pagination { display: none; } </style>