Read QOS playback and device statistics

You can read playback and device statistics from the QOSProvider as often as needed.

The PTQOSProvider class provides various statistics, including information related to buffering, bit rates, frame rates, time data, and various other topics.

You can also get information about the device, such as model, operating system, and manufacturer's device ID.

  1. Instantiate a media player.
  2. Create a PTQOSProvider object and attach it to the media player.
    qosProvider = [[PTQOSProvider alloc]initWithPlayer:self.player]; 

    The PTQOSProvider constructor takes a player context, because it will need it to retrieve device-specific information such as the operating system.

  3. Optionally read playback statistics.

    One solution for reading playback statistics would be 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];
        }
    }
  4. Optionally read 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];