With notifications, you can detect ID3 metadata from HLS streams embedded in ID3 tags at the Transport Stream segment level. You can then extract the information from the audio and video stream nested in the ID3 tag.
Conventionally, ID3 tags are used in conjunction with audio files. ID3 contains information related to the file, such as the name of the artist, track title, and album title. The PSDK recognizes ID3 metadata as follows:
ID3 v2.4.0. Versions that are not compliant are ignored.
ID3 tags in H.264 video and AAC audio streams, not in audio-only streams.
ID3 data encoded as UTF8 or as UTF16-BE (no BOM). Unspecified encoding is treated as UTF8.
When the PSDK determines that received data is ID3 metadata, it issues a notification with the following data:
InfoCode = 303007
TYPE = ID3
NAME = not present
ID = 0
Custom ad cues use the same onTimedMetadata listener to indicate the detection of a new tag. This should not cause any confusion, however, because custom ad cues are detected at the manifest level and ID3 tags are embedded in the stream.
@Override
public void onTimedMetadata(TimedMetadata timedMetadata) {
TimedMetadata.Type type = timedMetadata.getType();
if (type.equals(TimedMetadata.Type.ID3)){
long time = timeMetadata.getTime();
Metadata metadata = timedMetadata.getMetadata();
Set<String> keys = metadata.keySet();
for (String key : keys){
String value = metadata.getValue(key);
}
}
}