Chore: rework ad props (#4220)

* fix: move ad configuration in source
This commit is contained in:
Olivier Bouillet
2024-10-10 23:53:39 +02:00
committed by GitHub
parent 9a3fcda3b8
commit d86adc52f3
14 changed files with 171 additions and 76 deletions

View File

@@ -0,0 +1,18 @@
struct AdParams {
let adTagUrl: String?
let adLanguage: String?
let json: NSDictionary?
init(_ json: NSDictionary!) {
guard json != nil else {
self.json = nil
adTagUrl = nil
adLanguage = nil
return
}
self.json = json
adTagUrl = json["adTagUrl"] as? String
adLanguage = json["adLanguage"] as? String
}
}

View File

@@ -12,6 +12,7 @@ struct VideoSource {
/* DRM */
let drm: DRMParams
var textTracks: [TextTrack] = []
let adParams: AdParams
let json: NSDictionary?
@@ -29,6 +30,7 @@ struct VideoSource {
self.cropEnd = nil
self.customMetadata = nil
self.drm = DRMParams(nil)
adParams = AdParams(nil)
return
}
self.json = json
@@ -56,5 +58,6 @@ struct VideoSource {
self.textTracks = (json["textTracks"] as? NSArray)?.map { trackDict in
return TextTrack(trackDict as? NSDictionary)
} ?? []
adParams = AdParams(json["ad"] as? NSDictionary)
}
}