- Tutorials:
Global object to browse UPnP resources.
Exists only on supported devices.
Members
(static, readonly) TYPE_UNKNOWN :number
- See:
Type:
- number
(static, readonly) TYPE_FOLDER :number
- See:
Type:
- number
(static, readonly) TYPE_AUDIO :number
- See:
HEX value: 0x2000
Type:
- number
(static, readonly) TYPE_IMAGE :number
- See:
HEX value: 0x2400
Type:
- number
(static, readonly) TYPE_VIDEO :number
- See:
HEX value: 0x3000
Type:
- number
(static) onOpenServer :stbUPnP~onOpenServerCallback
Callback which calls after 'openServer' method call.
After setting this property with some function, you can handle result of stbUPnP.openServer.
Type:
Example
// prepare
stbUPnP.onOpenServer = function ( data, error ) {
if ( !error ) {
console.log(data);
}
};
// invoke
stbUPnP.openServer(stbUPnP.getServerListSync()[0].UDN);
// remove callback
stbUPnP.onOpenServer = null;
(static) onOpenContext :stbUPnP~onOpenContextCallback
Callback which calls after 'openContext' method call.
After setting this property with some function, you can handle result of stbUPnP.openContext.
Type:
Example
// prepare
stbUPnP.onOpenContext = function ( data, error ) {
if ( !error ) {
console.log(data);
}
};
// invoke
stbUPnP.openContext('1');
// remove callback
stbUPnP.onOpenContext = null;
(static) onOpenPage :stbUPnP~onOpenPageCallback
Callback which calls after 'openPage' method call.
After setting this property with some function, you can handle result of stbUPnP.openPage.
Type:
Example
// prepare
stbUPnP.openPage = function ( data, error ) {
if ( !error ) {
console.log(data);
}
};
// invoke
stbUPnP.openPage('1');
// remove callback
stbUPnP.openPage = null;
(static, readonly) pagesCount :number
Total pages count of the current folder.
Type:
- number
(static) pageSize :number
Items per page.
Set this attribute, and next 'openContext' call will return set value.
Type:
- number
(static, readonly) pageNumber :number
Current page number.
Type:
- number
Methods
(static) init() → {boolean}
Init UPnP service.
If service is not initialized and call other method init will be lazy called, but method logic don't start.
Returns:
operation status
- Type
- boolean
(static) deinit() → {boolean}
Deinit UPnP service.
Returns:
operation status
- Type
- boolean
(static) getServerListSync() → {Array.<stbUPnP~server>}
Get current server list in network.
Returns:
array of servers
- Type
- Array.<stbUPnP~server>
(static) openContext(id) → {boolean}
Start retrieving data from the passed stbUPnP.directory.ID.
If you need to go 'up' pass the current stbUPnP.directory.ParentID
Parameters:
Name | Type | Description |
---|---|---|
id |
string | folder ID |
Returns:
operation status
- Type
- boolean
(static) openPage(number) → {boolean}
Open page in the current folder.
Parameters:
Name | Type | Description |
---|---|---|
number |
number | page number |
Returns:
operation status
- Type
- boolean
(static) openServer(udn) → {boolean}
Open server, setting current server.
Parameters:
Name | Type | Description |
---|---|---|
udn |
string | server UDN |
Returns:
operation status
- Type
- boolean
(static) setFilterName(name) → {boolean}
Set not case sensitive filter by item name.
Filter item name on the occurrence of the passed string filter.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | string to filter |
Returns:
operation status
- Type
- boolean
(static) setFilterType(type) → {boolean}
Set filter by item type.
Parameters:
Name | Type | Description |
---|---|---|
type |
stbUPnP~contentType | content type |
Returns:
operation status
- Type
- boolean
Type Definitions
server
Properties:
Name | Type | Description |
---|---|---|
DeviceType |
number | device type |
FriendlyName |
number | server name |
InterfaceToHost |
string | server ip |
LocationURL |
string | server url |
ManufacturerName |
string | server manufacturer name |
UDN |
string | unique server identifier |
Represents server object, result of the stbUPnP.getServerListSync.
Type:
- Object
file
Properties:
Name | Type | Description |
---|---|---|
Bitrate |
number | media bitrate |
ContentType |
number | media type, one of the stbUPnP.TYPE_* |
BitsPerSample |
number | media bps |
Duration |
number | media file duration |
SampleFrequency |
number | media file frequency |
Size |
number | file size in bytes |
Value |
string | full url to the source |
Represents file object, one of the result array of the stbUPnP.getData.
Type:
- Object
error
Properties:
Name | Type | Default | Description |
---|---|---|---|
NONE |
number |
0
|
No error |
UNKNOWN |
number |
1
|
Unknown error |
WRONG_ARGUMENT |
number |
2
|
Wrong argument error |
NOT_FOUND |
number |
3
|
Not found error |
Represents source object, one of the result array of the stbUPnP.onOpenContext or stbUPnp.onOpenPage.
Type:
- Object
contentType
- See:
UPnP server content type.
Type:
- number
onOpenServerCallback(data, error)
Event handler callback.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | result object |
error |
stbUPnP~error | result status code |
onOpenContextCallback(data, error)
Event handler callback.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | result object |
error |
stbUPnP~error | result status code |
onOpenPageCallback(data, error)
Event handler callback.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | result object |
error |
stbUPnP~error | result status code |