Configuration Loading with a JSON Object Reference
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
Load a JSON Configuration
Use the following steps to initialize a player with a JSON configuration:
- Define a JSON object.
Format Description data Data Enables caching a data blob downloaded from your own web service and allows the iOS SDK to deserialize the JSON
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.json [String : Any] Enables creating the JSON as a dictionary within the code
-
Through J
WPlayerConfigurationBuilder()
, load a JSON configuration to configure the player.// build your config do { // This step could be done in your application as preloading, // and stored in memory. let url = URL(string:"url_of_your_config")! let jsonData = Data(contentsOf: url) // Create the config let config = try builder.configuration(data: jsonData).build() player.configurePlayer(with: config) } catch { // Handle build errors }
// build your config do { let json: JSONObject = [ "file": "yourvideo.mp4", "title": "video title" ] let config = try builder.configuration(json: json).build() player.configurePlayer(with: config) } catch { // Handle build errors }
iOS Specific Properties
The iOS SDK has support for the following properties.
(root)
Property | Description |
---|---|
allowsBackgroundPlayback Bool | Defines JWP VAST ads playback behavior when the app is in the background
Possible Values:
|
externalMetadata [JSONObject] | Defines external metadata to be triggered at a designated time
See: externalMetadata object |
externalPlaybackSettings JSONObject | Defines properties which change how external playback is affected with AirPlay devices
See: externalPlaybackSettings object |
locale String | ISO 639-1 locale associated with the caption track |
externalMetadata
Property | Description |
---|---|
endTime* Double | End time of the cue, expressed as a number of seconds from the beginning of the content |
identifier* String | Unique identifier used to represent the metadata cue |
startTime* Double | Start time of the cue, expressed in seconds from the beginning of the content |
externalPlaybackSettings
Format | Description |
---|---|
playbackEnabled Bool | Indicates whether the player allows switching to external playback mode
See also: allowsExternalPlayback |
usesExternalPlaybackWhileExternalScreenIsActive Bool | Indicates whether the player should automatically switch to external playback mode while the external screen mode is active
See also: usesExternalPlaybackWhileExternalScreenIsActive |
videoGravity String | Indicates how the layer displays video content within its bounds
Possible Values:
See also: videoGravity |
Captions
The iOS SDK supports all captions options.
Updated about 1 year ago