Track chapters and segments on Chromecast
- Topics:
- Media Analytics
CREATED FOR:
- User
- Admin
- Developer
The following instructions provide guidance for implementation using 2.x SDKs.
-
Identify when the chapter start event occurs and create the
ChapterObject
instance by using the chapter information.ChapterObject
chapter tracking reference:NOTE
These variables are only required if you are planning to track chapters.Variable NameDescriptionRequiredname
Chapter nameYesposition
Chapter positionYeslength
Chapter lengthYesstartTime
Chapter start timeYesChapter object: createChapterObject
chapterInfo = ADBMobile.media.createChapterObject("First Chapter", 1, CHAPTER1_LENGTH, CHAPTER1_START_POS);
-
If you include custom metadata for the chapter, create the context data variables for the metadata:
var chapterContextData = { segmentType: "Sample segment type" };
-
To begin tracking the chapter playback, track the
ChapterStart
event: trackEventADBMobile.media.trackEvent(ADBMobile.media.Event.ChapterStart, ChapterInfo, chapterContextData);
-
When playback reaches the chapter end boundary, as defined by your custom code, call the
ChapterComplete
event in theMediaHeartbeat
instance: trackEventADBMobile.media.trackEvent(ADBMobile.media.Event.ChapterComplete);
-
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), track the
ChapterSkip
event: trackEventADBMobile.media.trackEvent(ADBMobile.media.Event.ChapterSkip);
-
If there are any additional chapters, repeat steps 1 through 5.