The following instructions provide guidance for implementation across all 2.x SDKs.
If you are implementing a 1.x version of the SDK, you can download the 1.x Developers Guides here: Download SDKs.
Quality of experience tracking includes quality of service (QoS) and error tracking, both are optional elements and are not required for core media tracking implementations. You can use the media player API to identify the variables related to QoS and error tracking. Here are the key elements of tracking quality of experience:
Create or update the QoS object instance for the playback. QoS API Reference
Call trackEvent(Media.Heartbeat.Event.BitrateChange);
Identify when any of QOS metrics change during media playback, create the MediaObject
using the QoS information, and update the new QoS information.
QoSObject variables:
These variables are only required if you are planning to track QoS.
Variable | Description | Required |
---|---|---|
bitrate |
Current bitrate | Yes |
startupTime |
Startup time | Yes |
fps |
FPS value | Yes |
droppedFrames |
Number of dropped frames | Yes |
Make sure that getQoSObject()
method returns the most updated QoS information.
When playback switches bitrates, call the BitrateChange
event in the Media Heartbeat instance.
Update the QoS object and call the bitrate change event on every bitrate change. This provides the most accurate QoS data.
The following sample code uses the JavaScript 2.x SDK for an HTML5 media player. You should use this code with the core media playback code.
var mediaDelegate = new MediaHeartbeatDelegate();
...
// This is called periodically by MediaHeartbeat instance
mediaDelegate.prototype.getQoSObject = function() {
return this.qosInfo;
};
if (e.type == "qos_update") {
var qosInfo = MediaHeartbeat.createQoSObject(<BITRATE>,<STARTUP_TIME>,<FPS>,<DROPPED_FRAMES>);
mediaDelegate.qosInfo = qosInfo;
};
if (e.type == "bitrate_change") {
this.mediaHeartbeat.trackEvent(MediaHeartbeat.Event.BitrateChange, qosObject);
};