Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEC-11861 Add fast data config support #38

Merged
merged 6 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.