Track chapters and segments on Roku
Erstellt für:
- Benutzende
- Admin
- Entwickler
The following instructions provide guidance for implementation using 2.x SDKs.
Implement standard ad metadata
-
Identify when the chapter start event occurs and create the
ChapterObject
instance by using the chapter information.ChapterObject
chapter tracking reference:NOTEThese variables are only required if you are planning to track chapters.Variable NameDescriptionRequiredname
Chapter nameYesposition
Chapter positionYeslength
Chapter lengthYesstartTime
Chapter start timeYesChapter object:
chapterInfo = adb_media_init_chapterinfo(<CHAPTER_NAME>, <POSITION>, <LENGTH>, <START_TIME>);)
-
If you include custom metadata for the chapter, create the context data variables for the metadata:
chapterContextData = {} chapterContextData["seg_type"] = "seg_type" chapterContextData["seg_name"] = "seg_name" chapterContextData["seg_info"] = "seg_info"
-
To begin tracking the chapter playback, call the
ChapterStart
event in theMediaHeartbeat
instance:ADBMobile().mediaTrackEvent(MEDIA_CHAPTER_START, chapterInfo, chapterContextData)
-
When playback reaches the chapter end boundary, as defined by your custom code, call the
ChapterComplete
event in theMediaHeartbeat
instance.chapterContextData = {} ADBMobile().mediaTrackEvent(MEDIA_CHAPTER_COMPLETE, chapterInfo, chapterContextData)
-
If chapter playback did not complete because the user chose to skip the chapter (for example, if the user seeks out of the chapter boundary), call the
ChapterSkip
event in the MediaHeartbeat instance.chapterContextData = {} ADBMobile().mediaTrackEvent(MEDIA_CHAPTER_SKIP, chapterInfo, chapterContextData)
-
If there are any additional chapters, repeat steps 1 through 5.