# Nielsen DCR
ByteArk Player SDK for Android รองรับการเก็บสถิติการรับชมด้วย Nielsen DCR (Digital Content Ratings) (opens new window)
# การติดตั้ง
เพิ่ม Maven repository ของ Nielsen ใน settings.gradle (ดู Installation สำหรับขั้นตอนทั้งหมด)
pluginManagement {
repositories {
maven {
url 'https://raw.githubusercontent.com/NielsenDigitalSDK/nielsenappsdk-android/master/'
}
}
}
1
2
3
4
5
6
7
2
3
4
5
6
7
# สร้าง Nielsen Setting
val nielsenSetting = ByteArkPlayerFragment.createNielsenSetting(
"P1D9F153A-B0F5-43B9-A765-FF0330342DAD", // App ID
"ByteArk Demo", // App Name
"1.0", // SF Code
"", //
"DEBUG" // NolDevDebug
)
1
2
3
4
5
6
7
2
3
4
5
6
7
หรือใช้ Builder
val nielsenSetting = ByteArkNielsenSettingBuilder.Builder()
.withAppId("P1D9F153A-B0F5-43B9-A765-FF0330342DAD")
.withAppName("ByteArk Demo")
.withSfCode("th")
.withNolDevDebug("DEBUG")
.build()
1
2
3
4
5
6
2
3
4
5
6
| Builder method | Type | Description |
|---|---|---|
withAppId(appId: String) | String | Nielsen App ID (ติดต่อ Nielsen เพื่อรับ) |
withAppName(appName: String) | String | ชื่อแอป |
withSfCode(sfCode: String) | String | SF Code ของประเทศ ("th" สำหรับไทย) |
withNolDevDebug(debug: String) | String | "DEBUG" สำหรับ Development, "INFO" สำหรับ Production |
# ส่ง Metadata ต่อวิดีโอ
val nielsenMetaData = ByteArkNielsenMetaDataBuilder.Builder()
.withChannelName("CHANNEL_NAME")
.withClientId("CLIENT_ID")
.withSubBrandId("SUBBRAND_ID")
.withType("content")
.withAssetId("ASSET_ID")
.withProgram("PROGRAM_NAME")
.withTitle("EPISODE_TITLE")
.withLength(596L) // ความยาววิดีโอ (วินาที)
.withSegB("SegB")
.withSegC("SegC")
.withIsFullEpisode("y") // "y" หรือ "n"
.withAdLoadType("2") // "1" = Linear, "2" = Dynamic
.build()
val playerItem = ByteArkPlayerItemBuilder.Builder()
.withMediaId("VIDEO_ID")
.withTitle("Big Buck Bunny")
.withUrl("https://example.com/playlist.m3u8")
.withByteArkNielsenMetaData(nielsenMetaData)
.build()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# นำ Setting มาใช้
mPlayerFragment = ByteArkPlayerFragment.createInstance(
playerBuilder,
mFragmentListener,
companionAdSlot,
nielsenSetting,
playbackSetting,
lighthouseSetting,
chromeCastSetting
)
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9