Insight agent public APIs
The application may use the optional features the agent supports for their respective usage if required. The agent session must be active before using these APIs.
Update Content Information
This public API can be used to update the content information while the session is active. This is useful when content information is available after the playback starts, and the application may want to notify the agent about the updated content info.
// Informs the Insight Agent with the updated content information if the session is active
if(mInsightAgent != null) {
mInsightAgent.updateContent(contentInfoHolder);
}
Update Audio Language
This public API can be used to update the audio language change to the agent while the session is active. It should be noted that the audio language is subject to change during the session.
// Informs the Insight Agent with the video quality information if the session is active
if(mInsightAgent != null) {
mInsightAgent.setAudioLanguage(audioLanguage);
}
Update Subtitle Language
This public API can be used to update the subtitle language change to the agent while the session is active. Subtitle language is subject to change during the session.
// Informs the Insight Agent with the video quality information if the session is active
if(mInsightAgent != null) {
mInsightAgent.setSubtitleLanguage(subtitleLanguage);
}
Update Content Quality
This public API can be used to report the content quality to the agent while the session is active. Video quality is subject to change during the session as per network bandwidth and adaptation.
// Informs the Insight Agent with the video quality information if the session is active
if(mInsightAgent != null) {
mInsightAgent.setContentQuality(contentQuality);
}
Add Network Event
This public API can be used to report network events to the agent.
// Notify Network Event to the Insight Agent if the session is active
if(mInsightAgent != null) {
mInsightAgent.addNetworkEvent(statusCode, originatingUrl, httpHeaders, requestType, mediaType, loadStartedTimestamp, loadCompletedTimestamp);
}
Report FPS
This public API can be used to report current playback rendering frames per second to the agent.
// Notify Frames per Second to the Insight Agent if the session is active
if(mInsightAgent != null) {
mInsightAgent.setFramesPerSecond(numberOfFrames);
}
Report Current Bitrate
This public API can be used to report the current bitrate set for the player to the agent.
// Notify playback bitrate has changed to the Insight Agent if the session is active
if(mInsightAgent != null) {
mInsightAgent.setBitrate(bitrate);
}
The application can also inform the agent of bitrate change with bitrate, resolution and codec info. Here the codecs parameter is the CODECS
field in the definition of the variants in the manifest.
// Notify playback bitrate has changed to the Insight Agent if the session is active
if(mInsightAgent != null) {
mInsightAgent.setBitrate(bitrate, resolution, codecs);
}
Report Live Offset
This public API can be used to report the offset of the live playback when seeking on linear TV to the agent.
// Notify current live offset to the Insight Agent if the session is active
if(mInsightAgent != null) {
mInsightAgent.setOffsetFromLive(offset);
}
Add Error event
This public API can be used to report errors to the agent.
// Notify error to the Insight Agent if the session is active
if(mInsightAgent != null) {
mInsightAgent.addErrorEvent(errorCode, errorMessage);
}
Add MediaPlayer Error event
This public API can be used to report MediaPlayer errors to the agent. The agent wrapper takes care of reporting the playback errors by default.
// Notify error detected by MediaPlayer.OnErrorListener to the Insight Agent if the session is active
if(mInsightAgent != null) {
mInsightAgent.addMediaPlayerError(mediaPlayer, what, extra);
}