Player profiling

Some of the player's default values can be changed to target specific hardware (e.g. cpu type) or device (e.g. Manufacture/Device Name). These changes include:

  • Setting a Maximum Bitrate.
  • Select Hardware or Software Decode as the preferred decode method. Android 5.0 devices onward use hardware decoders by default but software decoders can be used if required; software decoders can only be used on pre-Android 5.0 devices.
  • Select HEVC as the prefered Codec (there are platform limitations when using HEVC, see below).

The changes are controlled by a configuration file called profiles.json. This guide explains how the profiles.json file is used by the player along with the supported key/value pairs.

The profiles.json file is an optional file.

It is recommended that the file in Sample Application "basic-playbacks/src/main/res/raw/profiles.json" is opened along with this guide for reference.

Example code

The profiles.json file must be placed in the Android 'raw' directory, for example, if used with the "basic-playbacks" sample application place it in directory "../basic-playbacks/src/main/res/raw".

profiles.json format

The profiles.json file has the following format:

{
  "type": "object",
  "properties": {
    "DeviceProfiles": {
      "type": "object",
      "properties": {
        "Specific": {
          "description": "can be used to target a specific device",
          "type": "array",
          "items": [
            {
              "type": "object",
              "properties": {   
                "Manufacturer": {
                  "description": "can be used to target a specific Manufacturer as reported by Android API DeviceInformation.getManufacturer()",
                  "type": "string"
                },
                "Model": {
                  "description": "can be used to target a specific Model as reported by Android API DeviceInformation.getModel()",
                  "type": "string"
                },
                "Product": {
                  "description": "can be used to target a specific Product as reported by Android API DeviceInformation.getProduct()",
                  "type": "string"
                },
                "Device": {
                  "description": "can be used to target a specific Device as reported by Android API DeviceInformation.getDevice()",
                  "type": "string"
                },
                "Board": {
                  "description": "can be used to target a specific Board as reported by Android API DeviceInformation.getBoard()",
                  "type": "string"
                },
                "Hardware": {
                  "description": "can be used to target specific Hardware as reported by Android API DeviceInformation.getHardware()",
                  "type": "string"
                },
                "Decoder": {
                  "description": "sets the default video decoder for this configuration, can be Hardware or Software (Default)",
                  "type": "string"
                },
                "MaxBitRate": {
                  "description": "sets the Maximum bitrate for this configuration",
                  "type": "string"
                },
                "Codecs": {
                   "type": "array",
                      "items": [
                      {
                        "description": "sets the preferred codec for this configuration, only allowed VIDEO_HEVC for this API(default codec is AVC), see hevc.md for restrictions on using the HEVC codec"
                        "type": "string"
                      }
                   ]
                }
              }
            }
          ]
        },
        "Generic": {
          "type": "array",
          "items": [
            {
              "type": "object",
              "properties": {
                "CpuCores": {
                  "description": "control max bitrate based on the number of CPU cores",
                  "type": "string"
                },
                "CpuFreq": {
                  "description": "control max bitrate based on the frequency",
                  "type": "string"
                },
                "Neon": {
                  "description": "control max bitrate based on whether the device has a neon co-processor, can be 1 (device supports neon) or 0 (device does not support neon)",
                  "type": "string"
                },
                "MaxBitRate": {
                  "description": "sets the Maximum bitrate for this configuration",
                  "type": "string"
                }
              }
            }
          ]
        }
      }
    }
  }
}

How the configuration settings in profiles.json are applied

  • When the player is initialized it fetches the device information via the Android DeviceInformation API.
  • If a match is found in the Specific array it will use that configuration.
  • If a match is found in the Generic array it will use that configuration.
  • If no match is found the player uses its default values.