Utility to parse HbbTV-compliant user-agent strings.
- Source:
Example
var userAgentParser = require("hbbtv-lib/tools/HbbTVUserAgentParser");
var userAgent = HbbTVUserAgentParser('User-Agent: HbbTV/1.2.1 (+PVR+DL; Sonic; 40VX700WDR; 1.32.455; 2.002; test reserved) BKit/445.27.1');
(require("HbbTVUserAgentParser"))(userAgentString) → {HbbTVUserAgent}
Parses an HbbTV compliant user agent string into its individual fields.
Parameters:
Name | Type | Description |
---|---|---|
userAgentString |
string | user agent string of an HbbTV TV. Applications can try to retrieve it from the navigator object, which is mandatory since 2.0, or via an HTTP request. |
- Source:
Returns:
an HbbTVUserAgent or null if ua does not include an HbbTV compliant user agent string.
- Type
- HbbTVUserAgent
Type Definitions
HbbTVUserAgent
Object with individual fields of an HbbTV user agent string.
Requirements for certain fields are defined in HbbTV 2 onwards, see section 7.3.2.4.
familyName is not included in HbbTV versions before 2.0.
'The "vendorName", "softwareVersion", "familyName" combination, along with "hardwareVersion" where
included, shall differ between terminals with significantly different implementations or performance.'
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
str |
string | a string with the HbbTV portion of the user agent string |
version |
HbbTVVersion | the version of the HbbTV specification the device thinks it complies to (due to ETSI rules, usually only differs in the minor part) |
options |
Array.<string> | one or multiple HbbTV capability strings, see clause 10.2.4, e.g. DRM |
vendor |
string | shall reflect the consumer-facing make / brand of the terminal |
model |
string | should be representative of the consumer-facing model name to allow log messages to be matched up with user reported problems |
swVersion |
string | software version |
hwVersion |
string | optional hardware version |
familyName |
string | shall have the semantics defined in clause 7.3.3.2 of the OIPF DAE specification [1] but shall additionally be chosen so as to be globally unique. This shall be achieved either by prefixing with a reverse domain name of the organisation allocating the remaining portion of the familyName, or by using a version 4 UUID as the familyName, formatted as a simple string (i.e. without any urn:uuid prefix) |
reserved |
string | for future extensions |
- Source:
HbbTVVersion
Object representing the version of the HbbTV specification.
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
major |
number | |
minor |
number | |
micro |
number |
- Source: