JWJSONParser
@objcMembers
final public class JWJSONParser : NSObject
This JSON parser helps to convert a json object into a JWPlayerConfiguration using the different configuration builders provided by JWPlayerKit.
-
Convert the content of a file into a
JWPlayerConfiguration.Note
The provided file must follow a proper JSON format.Throws
An error if the file can not be converted properly.Declaration
Swift
@objc(configFromUrl:error:) public static func config(from url: URL) throws -> JWPlayerConfigurationParameters
urlThe
URLto read.Return Value
A
JWPlayerConfigurationused to configure aJWPlayer. -
Convert a JSON object into a
JWPlayerConfiguration.Throws
An error if the json data can not be converted properly.Declaration
Swift
@objc(configFromJSONData:error:) public static func config(from jsonData: Data) throws -> JWPlayerConfigurationParameters
jsonDataThe JSON data.
Return Value
A
JWPlayerConfigurationused to configure aJWPlayer. -
Convert a JSON array into an array of
JWPlayerItemobjects.Note
The expected JSON format follows the JW Platform Delivery API playlist structure. Items that fail to parse are silently skipped.Throws
An error if the json data can not be converted properly.Declaration
Swift
@objc(playlistItemsFromJSONData:error:) public static func playlistItems(from jsonData: Data) throws -> [JWPlayerItem]Parameters
jsonDataThe JSON data representing an array of playlist item objects.
Return Value
An array of
JWPlayerItemused to load a playlist into aJWPlayer.