Skip to content

Commit

Permalink
FEC-11861 Add fastData config support (#38)
Browse files Browse the repository at this point in the history
Added fastData config support

Updated ReadMe file with fastData values.

Co-authored-by: Elisabet Massó <elisabet.masso@nicepeopleatwork.com>
  • Loading branch information
x-NR-x and emasso-npaw authored Apr 1, 2022
1 parent 22f65a8 commit d33149b
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ let youboraPluginParams: [String: Any] = [
"fatal": ["123", "errorcode"],
"nonFatal": ["123", "errorcode"],
"ignore": ["123", "errorcode"]
],
"fastDataConfig": [
"host": "fastDataHost",
"code": "fastDataCode",
"pingTime": 60,
"beatTime": 30,
"expirationTime": 600,
"youboraId": "fastDataYouboraId"
]
]

Expand Down
29 changes: 29 additions & 0 deletions Sources/YouboraConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ struct YouboraConfig: Decodable {
let app: App?
let session: Session?
let errors: Errors?

// For YBFastDataConfig
let fastDataConfig: FastDataConfig?

// Kaltura additional data
fileprivate let kalturaInfo: KalturaInfo?
Expand Down Expand Up @@ -378,6 +381,15 @@ struct Errors: Decodable {
// MARK: -
}

struct FastDataConfig: Decodable {
let host: String?
let code: String?
let pingTime: Double?
let beatTime: Double?
let expirationTime: Double?
let youboraId: String?
}

private struct KalturaInfo: Codable {
let sessionId: String?
let entryId: String?
Expand Down Expand Up @@ -632,3 +644,20 @@ extension YouboraConfig {
}
}

extension YouboraConfig {

func getYBFastDataConfig() -> YBFastDataConfig? {
if let fastDataConfig = fastDataConfig {
let ybFastDataConfig = YBFastDataConfig()
ybFastDataConfig.host = fastDataConfig.host
ybFastDataConfig.code = fastDataConfig.code
ybFastDataConfig.pingTime = fastDataConfig.pingTime as NSNumber?
ybFastDataConfig.beatTime = fastDataConfig.beatTime as NSNumber?
ybFastDataConfig.expirationTime = fastDataConfig.expirationTime as NSNumber?
ybFastDataConfig.youboraId = fastDataConfig.youboraId
return ybFastDataConfig
}
return nil
}
}

2 changes: 1 addition & 1 deletion Sources/YouboraPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class YouboraPlugin: BasePlugin, AppStateObservable {

YBLog.setDebugLevel(.debug)

ybPlugin = YBPlugin(options: youboraConfig?.options(), andAdapter: pkYouboraPlayerAdapter)
ybPlugin = YBPlugin(options: youboraConfig?.options(), adapter: pkYouboraPlayerAdapter, andConfig: youboraConfig?.getYBFastDataConfig())
ybPlugin?.adsAdapter = pkYouboraAdsAdapter

// Monitor app state changes
Expand Down
15 changes: 15 additions & 0 deletions docs/YouboraSessions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Youbora sessions integration

## To integrate youbora sessions follow this documentation:
https://documentation.npaw.com/npaw-integration/docs/application-analytics-custom-events-data-collection
This means: create a plugin instance that can be accessed globally, and call fireEvent() and fireNav() to report what you want.

## Mix session analytics and video analytics
After, to communicate youbora plugin for sessions and kaltura player:

### Before instantiating the player:

let youboradataconfig = plugin.viewTransform.fastDataConfig

### When instantiating the player, and before starting any video view set the object obtained previously in youboraconfig object used in player's constructor.

0 comments on commit d33149b

Please sign in to comment.