Show Menu
TOPICS×

Implement standard metadata on Android

Standard Metadata Constants

Constant name
Description  
MediaHeartbeat.MediaObjectKey.StandardMediaMetadata
Constant for attaching standard metadata on
MediaObject
.

Metadata keys API Reference

  • Create a
    HashMap
    of standard metadata key value pairs.
  • Set the standard metadata
    HashMap
    on
    MediaInfo
    using the Standard Metadata constant for the metadata.
  • Provide this
    MediaInfo
    object while invoking the
    trackSessionStart()
    API.

Sample implementations

Video

// Sample code to set standard metadata for tracking sessions Map <String, String> standardVideoMetadata= new HashMap<String, String>(); standardVideoMetadata.put(MediaHeartbeat.VideoMetadataKeys.EPISODE, "Sample Episode"); standardVideoMetadata.put(MediaHeartbeat.VideoMetadataKeys.SHOW, "Sample Show"); standardVideoMetadata.put(MediaHeartbeat.VideoMetadataKeys.SEASON, "Sample Season"); mediaInfo.setValue(MediaHeartbeat.MediaObjectKey.StandardVideoMetadata, standardVideoMetadata);

Audio

// Sample code to set standard metadata for tracking sessions Map <String, String> standardAudiooMetadata= new HashMap<String, String>(); standardAudiooMetadata.put(MediaHeartbeat.AudiooMetadataKeys.ARTIST, "Sample Artist"); standardAudiooMetadata.put(MediaHeartbeat.AudiooMetadataKeys.ALBUM, "Sample Album"); standardAudiooMetadata.put(MediaHeartbeat.AudiooMetadataKeys.LABEL, "Sample Label"); mediaInfo.setValue(MediaHeartbeat.MediaObjectKey.StandardAudiooMetadata, standardAudiooMetadata);