Quality of service (QoS) offers a detailed view into how the video engine is performing. TVSDK provides detailed statistics about playback, buffering, and devices.
You can read playback, buffering, and device statistics from the PTQOSProvider
class.
The PTQOSProvider
class provides various statistics, including information about buffering, bit rates, frame rates, time data, and so on.
It also provides information about the device, such as the model, operating system, and manufacturer’s device ID.
You cannot change the playback buffer size, but you can monitor the status of the buffer size for debugging or analysis. PTPlaybackInformation
includes such properties as playbackBufferFull
and playbackLikelyToKeepUp
.
Instantiate a media player.
Create a PTQOSProvider
object and attach it to the media player.
The PTQOSProvider
constructor takes a player context so that it can retrieve device-specific information.
qosProvider = [[PTQOSProvider alloc]initWithPlayer:self.player];
(Optional) Read the playback statistics.
One solution to read playback statistics is to have a timer, such as an NSTimer
, that periodically fetches the new QoS values from the PTQOSProvider
. For example:
- (void)printPlaybackInfoLog {
PTPlaybackInformation *playbackInfo = qosProvider.playbackInformation;
if (playbackInfo) {
// For example:
NSString *infoLog = [NSString stringWithFormat:@"observedBitrate :
%f\n",playbackInfo.observedBitrate];
[consoleView logMessage:@"====%@\n\n",infoLog];
}
}
(Optional) Read the device-specific information.
PTDeviceInformation *devInfo = qosProvider.deviceInformation;
if (devInfo) {
[consoleView logMessage:@"=== qosDeviceInfo:==\n os =%@\n model =
%@\n id =%@\n\n", devInfo.os, devInfo.model, devInfo.id];
}
[NSTimer scheduledTimerWithTimeInterval:2.0 target:self
selector:@selector(printPlaybackInfoLog) userInfo:nil repeats:YES];