• Platforms
  • Partners
  • Forums
  • 日本語
  • TLC Tealium Learning Center Tealium Learning
    Community
  • Discussions & Ideas Dicussions & Ideas
  • Product Guides Product Guides
  • Knowledge Base Knowledge Base
  • Developer Docs Developer Docs
  • Education Education
  • TLC Blog TLC Blog
  • Support Desk Support Desk
  • CDH Customer Data Hub Customer Data Hub
  • Mobile
  • Getting Started
    • Overview
    • Quick Start Guide
    • Mobile Concepts
    • Client-Side
    • Server-Side
    • Tracking Webviews
    • Data Layer
    • Consent Management
    • Event Batching
    • User Location and Geofencing
    • Media Tracking
    • Deep Links
    • Timed Events
    • Trace
    • Hosted Data Layer
    • Adobe Visitor Service Module
    • Feature Comparison
    • Troubleshooting
  • Remote Commands
    • Overview
    • How It Works
    • Integrations
      • Adjust
      • AppsFlyer
      • Branch
      • Braze
      • Contentsquare
      • Facebook
      • Firebase
      • Kochava
      • Usabilla
  • Android (Java)
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • Consent Management
    • Module List
      • Ad Identifier Module
      • Crash Reporter Module
      • Install Referrer Module
      • Lifecycle Tracking Module
      • Location Module
      • Optimizely X Tracking Module
    • Android TV
    • Android Wear
    • API Reference
      • ConsentManager
      • DataSources
      • Lifecycle
      • Tealium
      • Tealium.Config
      • TealiumLocation
    • Release Notes
  • Android (Kotlin)
    • Overview
    • Install
    • Track
    • Data Layer
    • Consent Management
    • Identity Resolution
    • Module List
      • Ad Identifier Module
      • AutoTracking Module
      • AdobeVisitorService Module
      • Collect Module
      • Collectors Module
      • Crash Reporter Module
      • In-App Purchase Module
      • Install Referrer Module
      • Lifecycle Tracking Module
      • Location Manager Module
      • Media Module
      • RemoteCommands Module
      • Tag Management Dispatcher Module
      • Visitor Service Module
    • Android TV
    • API Reference
      • ConsentCategory
      • ConsentManager
      • CurrentVisit
      • DataLayer
      • Lifecycle
      • LocationManager
      • Media
      • Tealium
      • TealiumConfig
      • VisitorProfile
      • VisitorService
    • Release Notes
  • Cordova 1.x
    • Overview
    • Install
    • Track
    • Data Management
    • Module List
      • Ad Identifier Module
      • Crash Reporter Module
      • Install Referrer Module
    • API Reference
    • Release Notes
  • Cordova 2.x
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • Flutter 1.x
    • Overview
    • Install
    • Track
    • Consent Management
    • Data Management
    • API Reference
    • Release Notes
  • Flutter 2.x
    • Overview
    • Install
    • Track
    • Consent Management
    • Data Management
    • API Reference
      • Tealium
      • TealiumConfig
      • VisitorProfile
    • Release Notes
  • iOS (Objective-C)
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • Consent Management
    • Tag Management
    • Module List
      • Lifecycle Tracking Module
    • tvOS
    • watchOS
    • API Reference
    • Release Notes
  • iOS (Swift) 1.x
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • App Extensions
    • Identity Resolution
    • Consent Management
    • Modules
    • Module List
      • AppData Module
      • Attribution Module
      • AutoTracking Module
      • Collect Module
      • Connectivity Module
      • CrashReporter Module
      • DataSource Module
      • DefaultStorage Module
      • Delegate Module
      • DeviceData Module
      • DispatchQueue Module
      • FileStorage Module
      • Lifecycle Module
      • Location Module
      • Logger Module
      • PersistentData Module
      • RemoteCommands Module
      • TagManagement Module
      • VisitorService Module
      • VolatileData Module
    • Feature Comparison
    • Working with Objective-C
    • API Reference
      • TealiumConfig
      • TealiumConsentCategories
      • TealiumConsentManagerDelegate
      • TealiumConsentManager
      • TealiumInstanceManager
      • TealiumPersistentData
      • TealiumVolatileData
      • Tealium
    • Release Notes
  • iOS (Swift) 2.x
    • Overview
    • Install
    • Track
    • Data Layer
    • Consent Management
    • App Extensions
    • Identity Resolution
    • Modules
    • Module List
      • AppData Module
      • AdobeVisitorService Module
      • Attribution Module
      • AutoTracking Module
      • Collect Module
      • Connectivity Module
      • CrashReporter Module
      • DeviceData Module
      • In-App Purchase Module
      • Lifecycle Module
      • Location Module
      • Media Module
      • RemoteCommands Module
      • TagManagement Module
      • VisitorService Module
    • Working with Objective-C
    • API Reference
      • LocationModule
      • MediaSession
      • Tealium
      • TealiumConfig
      • TealiumConsentCategories
      • TealiumConsentManager
      • TealiumDataLayer
      • TealiumInstanceManager
    • Release Notes
  • NativeScript
    • Overview
    • Install
    • Track
    • API Reference
      • Tealium
      • TealiumConfig
    • Release Notes
  • React Native 1.x
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • React Native 2.x
    • Overview
    • Install
    • Track
    • Location Module
    • API Reference
    • Release Notes
  • Unity 1.x
    • Overview
    • Install
    • Track
    • API Reference
  • Unity 2.x
    • Overview
    • Install
    • Track
    • API Reference
  • Xamarin 1.x
    • Overview
    • Install
    • Track
    • Data Management
    • Consent Management
    • API Reference
    • Release Notes
  • Xamarin 2.x
    • Overview
    • Install
    • Track
    • Data Layer
    • Consent Management
    • API Reference
    • Release Notes
  • Web
  • Getting Started
    • Overview
    • Quick Start Guide
    • Web Concepts
    • Data Layer
      • An Introduction to the Data Layer
      • How the Data Layer Works for Websites
      • Data Layer Best Practices
      • Definitions
        • Retail
        • Publisher
        • Hotel
        • Travel
        • Basic Video Tracking
  • Adobe Launch
    • Overview
    • Install
    • Data Layer
  • AMP
    • Overview
    • Install
    • Track
    • Data Layer
  • Angular
    • Overview
    • Install
    • Track
    • API Reference
  • Google Tag Manager
    • Overview
    • Install
    • Data Layer
  • JavaScript (Web)
    • Overview
    • Install
    • Track
    • Data Layer
    • Universal Data Object (utag_data)
    • Universal Tag (utag.js)
    • Data Layer Object (b)
    • Single-Page Applications
    • Settings
    • Debugging
    • API Reference
      • Cookie Functions
      • GDPR Functions
      • Tracking Functions
      • Utility Functions
    • Release Notes
  • Server
  • C#
    • Overview
    • Install
    • Track
    • Data Layer
    • API Reference
    • Release Notes
  • HTTP API
    • Overview
    • Endpoint
    • Data Layer
  • Java
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • Node
    • Overview
    • Install
    • Track
    • API Reference
  • Python
    • Overview
    • Install
    • Track
    • API Reference
  • Roku
    • Overview
    • Install
    • Track
    • API Reference
  • Ruby
    • Overview
    • Install
    • Track
    • API Reference
ANDROID KOTLIN

Media

Reference guide for Media class and methods provided by Tealium for Android (Kotlin).

Class: Media

The Media class provides methods for tracking streaming media in apps through the use of custom events. Learn more about media tracking.

The following summarizes the commonly used methods of the Media class for Tealium Kotlin.

Method Description
clickAd() The user clicked on a ad that is currently playing.
custom() Sends a custom event status to the data layer.
endAd() The ad ended.
endAdBreak() The ad break ended.
endBuffer() The buffer ended.
endChapter() The chapter ended.
endSeek() The user ended seeking.
endSession() The session ended, including ads and content.
pause() The user paused the media.
ping() Sends an interval event to the data layer.
play() The media content started playing.
resumeSession() The session resumed.
sendMilestone() Sends milestone data to the data layer.
sendSummary() Sends summary data to the data layer.
skipAd() The user skipped the current ad.
skipChapter() The user skipped the chapter.
startAdBreak() The ad break started.
startAd() The ad started.
startBuffer() The buffer started.
startChapter() The chapter started.
startSeek() The user started seeking.
startSession() The session started.
updatePlayerState() The start or end of the player state.
updateQOE() Sets the quality of experience bitrate value.

clickAd()

The user clicked on a ad that is currently playing.

tealium?.media?.clickAd(event)

custom()

Sends a custom event status to the data layer.

tealium?.media?.custom(name)
Parameter Type Description
name String The custom event name.

endAd()

The ad ended.

tealium?.media?.endAd()

endAdBreak()

Ends latest ad break for the current session. Only valid in a current ad break.

tealium?.media?.endAdBreak()

endBuffer()

The buffer ended.

tealium?.media?.endBuffer()

endChapter()

The chapter ended.

tealium?.media?.endChapter()

endSeek()

The user ended seeking. Records seek ended at given position.

tealium?.media?.endSeek(position)
Parameter Type Description
position Int The index position in the media, in seconds, where seek ended.

Example:

tealium?.media?.startSeek(10)

endSession()

The session ended, including ads and content.

tealium?.media?.endSession()

pause()

The user paused the media.

tealium?.media?.pause()

ping()

Sends an interval event to the data layer. This method is called automatically every 10 seconds if the tracking type for the MediaContent object is set to INTERVAL or INTERVAL_MILESTONE.

tealium?.media?.ping()

Learn more about media tracking types.

play()

The media content started playing.

tealium?.media?.play()

resumeSession()

The session resumed.

tealium?.media?.startSession()

sendMilestone()

Sends a milestone event to the data layer. This method is called automatically, based on the The percent of content played, the tracking type for the MediaContent object is set to MILESTONE or INTERVAL_MILESTONE.

tealium?.media?.sendMilestone()

Milestone values:

Media % Played Milestone Value
8.0 - 12.0 10%
23.0 - 27.0 25%
48.0 - 52.0 50%
73.0 - 77.0 75%
88.0 - 92.0 90%
97.0 - 100.0 100%

Learn more about media tracking types.

sendSummary()

Sends summary data to the data layer. This method is called automatically on endSession() if the tracking type for the MediaContent object is set to SUMMARY.

tealium?.media?.sendSummary()

Learn more about media tracking types.

skipAd()

The user skipped the current ad.

tealium?.media?.skipAd()

skipChapter()

The user skipped the chapter.

tealium?.media?.skipChapter()

startAd()

The ad started. Call the endAd() method when the ad completes.

tealium?.media?.startAd(ad)
Parameter Type Description
ad Ad The ad object.

Example:

tealium?.media?.startAd(Ad("Ad  1"))

startAdBreak()

The ad break started. Call the endAdBreak() method when the ad break completes.

tealium?.media?.startAdBreak(break)
Parameter Type Description
break AdBreak The ad break object.

Example:

val adBreak = AdBreak(name = "Ad Break 1")
tealium?.media?.startAdBreak(adBreak)

startBuffer()

The buffer started. Call the endBuffer() method when buffering completes.

tealium?.media?.startBuffer()

startChapter()

The chapter started. Call the endChapter() method when the chapter completes.

tealium?.media?.startChapter(chapter)
Parameter Type Description
chapter Chapter The chapter segment name.

Example:

tealium?.media?.startChapter(Chapter(name = "Chapter 1"))

startSeek()

The user started seeking. Call the endSeek() method when seeking completes.

tealium?.media?.startSeek(position)
Parameter Type Description
position Int The index position in the media, in seconds, where seek started.

Example:

tealium?.media?.startSeek(10)

startSession()

The session started. Call the endSession() method when session completes.

tealium?.media?.startSession()

updatePlayerState()

The start or end of the player state.

tealium?.media?.updatePlayerState(state)
Parameter Type Description
state State constant The media state

The following State constants are available:

Value Description
CLOSED_CAPTION Closed caption state type.
FULLSCREEN Full screen state type.
IN_FOCUS In focus state type.
MUTE Mute state type.
PICTURE_IN_PICTURE Picture in picture state type.

Example:

tealium?.media?.updatePlayerState(fullscreen)

Learn more about the player state.

updateQOE()

Sets the quality of experience bitrate value in kilobits per second (kbps) of the current session.

tealium?.media?.updateQOE(rate)
Parameter Type Description
rate Int The bitrate value.

Example:

tealium?.media?.updateQOE(1500)

Class: MediaContent

The MediaContent class creates a media content object.

val mediaContent: MediaContent = MediaContent(
  name: MEDIA_NAME,
  streamType: MEDIA_STREAM_TYPE,
  mediaType: MEDIA_TYPE,   
  qoe: MEDIA_QOE,
  trackingType: MEDIA_TRACKING_TYPE,
  state = MEDIA_STATE,
  customID = MEDIA_CUSTOM_ID,
  duration: MEDIA_DURATION,
  playerName: MEDIA_PLAYER_NAME,
  channelName: MEDIA_CHANNEL_NAME,
  metadata: MEDIA_METADATA
)
Variable Name Type Description Required
name String The name of the media content. Yes
streamType StreamType The type of media stream. Yes
mediaType MediaType The type of media (video or audio). Yes
qoe QoE The quality of experience bitrate value. Yes
trackingType TrackingType The level of event tracking. (default: TrackingType.FULL_PLAYBACK) Yes
state PlayerState The media player state type.
customId String The custom identifier name.
duration Int The media duration, in seconds, such as 130
playerName String The media player name.
channelName String The media channel name.
metadata [String: Any] Additional media metadata.

Class: Ad

The Ad class creates an ad object.

val ad = Ad(
  id = MEDIA_AD_ID,
  name = MEDIA_AD_NAME,
  duration = MEDIA_AD_DURATION,
  position = MEDIA_AD_POSITION,
  advertiser = MEDIA_AD_ADVERTISER,
  creativeId = MEDIA_AD_CREATIVE_ID,
  campaignId = MEDIA_AD_CAMPAIGN_ID,
  placementId = MEDIA_AD_PLACEMENT_ID,
  siteId = MEDIA_AD_SITE_ID,
  creativeUrl = MEDIA_AD_CREATIVE_URL,
  numberOfLoads = MEDIA_AD_LOAD,
  pod = MEDIA_AD_POD,
  playerName = MEDIA_AD_PLAYER_NAME
)
Parameter Type Description Required
name String The name of the ad. Yes
duration Double The ad duration, in seconds, such as 130
position Int The current index position of the ad, in seconds.
advertiser String The ad advertiser.
creativeId String The ad creative identifier.
campaignId String The ad campaign identifier.
placementId String The ad placement identifier.
siteId String The ad site identifier.
creativeUrl String The ad creative URL.
numberOfLoads Int The number of ad loads.
pod String The ad pod.
playerName String The ad player name.

Class: AdBreak

The AdBreak class creates an ad break object.

val adBreak = AdBreak(
  id = MEDIA_AD_BREAK_ID,
  name = MEDIA_AD_BREAK_NAME,
  duration = MEDIA_AD_BREAK_DURATION,
  index = MEDIA_AD_BREAK_INDEX,
  position = MEDIA_AD_BREAK_POSITION
)
Parameter Type Description Required
id String The ad break unique identifier.
name String The ad break name. Yes
duration Double The ad break duration, in seconds, such as 130
index Int The index of the ad break.
position Int The current index position of the ad break, in seconds.

Class: Chapter

The Chapter class creates a chapter object.

val chapterObject = Chapter(
  name = MEDIA_CHAPTER_NAME,
  duration = MEDIA_CHAPTER_DURATION,
  position = MEDIA_CHAPTER_POSITION,
  metadata = MEDIA_CHAPTER_METADATA
)

The following are the Chapter object parameters. Parameters must be in order if you are not using parameter names, such as duration = when creating the object.

Variable Name Type Description Required
name String The name of the chapter. Yes
duration Double The chapter duration, in seconds, such as 130
position Int The chapter position index.
metadata [String: Any] Additional chapter media metadata.
"LocationManager "
Previous
LocationManager
Next
Tealium
"Tealium"

 

Was this article helpful?

This page was last updated: November 9, 2021      

Thank you for your feedback!

Table of Contents

  • Class: Media
    • clickAd()
    • custom()
    • endAd()
    • endAdBreak()
    • endBuffer()
    • endChapter()
    • endSeek()
    • endSession()
    • pause()
    • ping()
    • play()
    • resumeSession()
    • sendMilestone()
    • sendSummary()
    • skipAd()
    • skipChapter()
    • startAd()
    • startAdBreak()
    • startBuffer()
    • startChapter()
    • startSeek()
    • startSession()
    • updatePlayerState()
    • updateQOE()
  • Class: MediaContent
  • Class: Ad
  • Class: AdBreak
  • Class: Chapter
  • Platforms
  • Partners
  • Forums
  • Mobile
  • Getting Started
  • Remote Commands
  • Android (Java)
  • Android (Kotlin)
  • Cordova 1.x
  • Cordova 2.x
  • Flutter 1.x
  • Flutter 2.x
  • iOS (Objective-C)
  • iOS (Swift) 1.x
  • iOS (Swift) 2.x
  • NativeScript
  • React Native 1.x
  • React Native 2.x
  • Unity 1.x
  • Unity 2.x
  • Xamarin 1.x
  • Xamarin 2.x
  • Web
  • Getting Started
  • Adobe Launch
  • AMP
  • Angular
  • Google Tag Manager
  • JavaScript (Web)
  • Server
  • C#
  • HTTP API
  • Java
  • Node
  • Python
  • Roku
  • Ruby