User Tools

Site Tools


qualitytoggle

Quality Toggle

General

Projekktor allows to provide multiple quality versions of a video-, audio- or image-file. You can set up as many different versions of a specific media as you like. The player automatically gathers a couple of two “best matches” the user can toggle between. The player´s decision is based upon the available display dimensions which may vary on different platforms and devices. Quality toggling works transparently and independently of the available platform (html5, flash etc.pp.). Btw: This mechanism doesn´t affect native quality-toggling e.g. for HDS and HLS streams however.

Configuration

Configuration is handled via the “playbackQualities” config parameter. It assigns internal quality “key”s and a set of detections rules in order to parametrize the auto-detection logic.

Simple Width-Height Testing

Let´s have a look on this very basic example object:

 
{
  {key: 'small', minHeight: 240, minWidth: 240},
  {key: 'highres', minHeight: 1081, minWidth: 0}           
}

The object holds two rule-sets for two different qualities: “small” and “highres”. Note that the name of the keys are just an example. You can name them as you like.

The properties “minHeight” and “minWidth” define the rule itself. The given names should be quite self-explanatory at this point. So, the quality key “small” will be chosen in case the player has minimum dimensions of 240x240px but less than 1081px of height. Setting either “minHeigh” or “minWidth” to zero will make the respective property ignored. So for “highres” only the height of the player will be tested but not its width.

Complex Aspect Ratio Testing

Here we go. E.g.:

 
{
  {key: 'small', minHeight: 240, minWidth: 240},
  {key: 'medium', minHeight: 360, minWidth: [{ratio: 1.77, minWidth: 640}, {ratio: 1.33, minWidth: 480}]},
  {key: 'highres', minHeight: 1081, minWidth: 0}           
}

No panik. The “minWidth” property can be set to take respect of aspect ratios and as such it can be an object. Because the height of the player is the reference value for further calculations “minHeight” can only of type integer.

In addition to the decision tree described in the simple example above the player got a new rule-set keyed with “medium”.

For “medium” the player must have a minimum height of 360px. Furthermore - talking about {ratio: 1.77, minWidth: 640} - the minimum width must be either 640px in case the player has at least an aspect ratio of 16:9 (because 16 / 9 = 1.77) or a minimum width of 480px if the player has at least an aspect ratio of 4:3 (4/3=1.33). You can set as many aspect ratio rules as you want to.

Complex Aspect Ratio Testing

Below you´ll find a complex setup and a (hopefully) human readable translation:

{key: 'small', minHeight: 240, minWidth: 240},
{key: 'medium', minHeight: 360, minWidth: [{ratio: 1.77, minWidth: 640}, {ratio: 1.33, minWidth: 480}]},
{key: 'large', minHeight: 480, minWidth: [{ratio: 1.77, minWidth: 853}, {ratio: 1.33, minWidth: 640}]},
{key: 'hd1080', minHeight: 1080, minWidth: [{ratio: 1.77, minWidth: 1920}, {ratio: 1.33, minWidth: 1440}]},
{key: 'hd720', minHeight: 720, minWidth: [{ratio: 1.77, minWidth: 1280}, {ratio: 1.33, minWidth: 960}]},
{key: 'highres', minHeight: 1081, minWidth: 0}           
  • small: The player height is 240px and its width at least 240px
  • medium: Player height is 360px, and player dimensions are 640px by 360px (for 16:9 aspect ratio) or 480px by 360px (for 4:3 aspect ratio).
  • large: Player height is 480px, and player dimensions are 853px by 480px (for 16:9 aspect ratio) or 640px by 480px (for 4:3 aspect ratio).
  • hd720: Player height is 720px, and player dimensions are 1280px by 720px (for 16:9 aspect ratio) or 960px by 720px (for 4:3 aspect ratio).
  • hd1080: Player height is 1080px, and player dimensions are 1920px by 1080px (for 16:9 aspect ratio) or 1440px by 1080px (for 4:3 aspect ratio).
  • highres: Player height is greater than 1080px, which means that the player's aspect ratio is greater than 1920px by 1080px.

Setup

/* small: Player height is 240px, and player dimensions are at least 320px by 240px for 4:3 aspect ratio. medium: Player height is 360px, and player dimensions are 640px by 360px (for 16:9 aspect ratio) or 480px by 360px (for 4:3 aspect ratio). large: Player height is 480px, and player dimensions are 853px by 480px (for 16:9 aspect ratio) or 640px by 480px (for 4:3 aspect ratio). hd720: Player height is 720px, and player dimensions are 1280px by 720px (for 16:9 aspect ratio) or 960px by 720px (for 4:3 aspect ratio). hd1080: Player height is 1080px, and player dimensions are 1920px by 1080px (for 16:9 aspect ratio) or 1440px by 1080px (for 4:3 aspect ratio). highres: Player height is greater than 1080px, which means that the player's aspect ratio is greater than 1920px by 1080px. */

qualitytoggle.txt · Last modified: 2013/06/13 18:25 by operator