Version: 1.0
Status: ⚫⚪⚪
Streamer plugin for Thunder framework.
This document describes purpose and functionality of the Streamer plugin. It includes detailed specification of its configuration, methods and properties provided, as well as notifications sent.
All identifiers on the interface described in this document are case-sensitive. Thus, unless stated otherwise, all keywords, entities, properties, relations and actions should be treated as such.
The table below provides and overview of acronyms used in this document and their definitions.
Acronym | Description |
---|---|
API | Application Programming Interface |
HTTP | Hypertext Transfer Protocol |
JSON | JavaScript Object Notation; a data interchange format |
JSON-RPC | A remote procedure call protocol encoded in JSON |
The table below provides and overview of terms and abbreviations used in this document and their definitions.
Term | Description |
---|---|
callsign | The name given to an instance of a plugin. One plugin can be instantiated multiple times, but each instance the instance name, callsign, must be unique. |
Ref ID | Description |
---|---|
HTTP | HTTP specification |
JSON-RPC | JSON-RPC 2.0 specification |
JSON | JSON specification |
Thunder | Thunder API Reference |
The plugin is designed to be loaded and executed within the Thunder framework. For more information about the framework refer to [Thunder].
The table below lists configuration options of the plugin.
Name | Type | Description |
---|---|---|
callsign | string | Plugin instance name (default: Streamer) |
classname | string | Class name: Streamer |
locator | string | Library name: libWPEFrameworkStreamer.so |
autostart | boolean | Determines if the plugin is to be started automatically along with the framework |
The following methods are provided by the Streamer plugin:
Streamer interface methods:
Method | Description |
---|---|
create | Creates a stream instance |
destroy | Destroys a stream instance |
load | Loads a source into a stream |
attach | Attaches a decoder to the streamer |
detach | Detaches a decoder from the streamer |
Creates a stream instance.
Name | Type | Description |
---|---|---|
params | object | |
params.type | string | Stream type (must be one of the following: undefined, cable, handheld, satellite, terrestrial, dab, rf, unicast, multicast, ip) |
Name | Type | Description |
---|---|---|
result | number | Stream ID |
Code | Message | Description |
---|---|---|
30 | ERROR_BAD_REQUEST |
Invalid stream type given |
2 | ERROR_UNAVAILABLE |
Fronted of the selected stream type is not available |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.create",
"params": {
"type": "cable"
}
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": 0
}
Destroys a stream instance.
Name | Type | Description |
---|---|---|
params | object | |
params.id | number | Stream ID |
Name | Type | Description |
---|---|---|
result | null | Always null |
Code | Message | Description |
---|---|---|
22 | ERROR_UNKNOWN_KEY |
Unknown stream ID given |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.destroy",
"params": {
"id": 0
}
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": null
}
Loads a source into a stream.
Also see: statechange
Name | Type | Description |
---|---|---|
params | object | |
params.id | number | Stream ID |
params.location | string | Location of the source to load |
Name | Type | Description |
---|---|---|
result | null | Always null |
Code | Message | Description |
---|---|---|
22 | ERROR_UNKNOWN_KEY |
Unknown stream ID given |
15 | ERROR_INCORRECT_URL |
Invalid location given |
1 | ERROR_GENERAL |
Undefined loading error |
5 | ERROR_ILLEGAL_STATE |
Stream is not in a valid state |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.load",
"params": {
"id": 0,
"location": "http://example.com/sample.m3u8"
}
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": null
}
Attaches a decoder to the streamer.
Name | Type | Description |
---|---|---|
params | object | |
params.id | number | Stream ID |
Name | Type | Description |
---|---|---|
result | null | Always null |
Code | Message | Description |
---|---|---|
22 | ERROR_UNKNOWN_KEY |
Unknown stream ID given |
12 | ERROR_INPROGRESS |
Decoder already attached |
5 | ERROR_ILLEGAL_STATE |
Stream is not in a valid state |
2 | ERROR_UNAVAILABLE |
No free decoders available |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.attach",
"params": {
"id": 0
}
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": null
}
Detaches a decoder from the streamer.
Name | Type | Description |
---|---|---|
params | object | |
params.id | number | Stream ID |
Name | Type | Description |
---|---|---|
result | null | Always null |
Code | Message | Description |
---|---|---|
22 | ERROR_UNKNOWN_KEY |
Unknown stream ID given |
5 | ERROR_ILLEGAL_STATE |
Stream is not in a valid state or decoder not attached |
12 | ERROR_INPROGRESS |
Decoder is in use |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.detach",
"params": {
"id": 0
}
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": null
}
The following properties are provided by the Streamer plugin:
Streamer interface properties:
Property | Description |
---|---|
speed | Playback speed |
position | Stream position |
window | Stream playback window |
speeds RO | Speeds supported by the stream player |
streams RO | All created stream instance IDs |
type RO | Type of a stream |
drm RO | DRM type associated with a stream |
state RO | Current state of a stream |
metadata RO | Metadata associated with the stream |
error RO | Most recent error code |
elements RO | Stream elements |
Provides access to the playback speed.
Speed (in percentage)
Also see: statechange
Name | Type | Description |
---|---|---|
(property) | number | Speed percentage; e.g.: 0 - pause, 100 - normal playback, -100 - rewind, -200 - reverse at twice the normal speed, 50 - forward at half speed, etc. Must be one of the speeds supported by the player |
The stream id shall be passed as the index to the property, e.g. Streamer.1.speed@0.
Code | Message | Description |
---|---|---|
22 | ERROR_UNKNOWN_KEY |
Unknown stream ID given |
5 | ERROR_ILLEGAL_STATE |
Player is not in a valid state or decoder not attached |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.speed@0"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": 100
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.speed@0",
"params": 100
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": "null"
}
Provides access to the stream position.
Name | Type | Description |
---|---|---|
(property) | number | Position (in milliseconds) |
The stream id shall be passed as the index to the property, e.g. Streamer.1.position@0.
Code | Message | Description |
---|---|---|
22 | ERROR_UNKNOWN_KEY |
Unknown stream ID given |
5 | ERROR_ILLEGAL_STATE |
Player is not in a valid state or decoder not attached |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.position@0"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": 60000
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.position@0",
"params": 60000
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": "null"
}
Provides access to the stream playback window.
Name | Type | Description |
---|---|---|
(property) | object | Geometry of the window |
(property).x | number | Horizontal position of the window (in pixels) |
(property).y | number | Vertical position of the window (in pixels) |
(property).width | number | Width of the window (in pixels) |
(property).height | number | Height of the window (in pixels) |
The stream id shall be passed as the index to the property, e.g. Streamer.1.window@0.
Code | Message | Description |
---|---|---|
22 | ERROR_UNKNOWN_KEY |
Unknown stream ID given |
5 | ERROR_ILLEGAL_STATE |
Player is not in a valid state or decoder not attached |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.window@0"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": {
"x": 0,
"y": 0,
"width": 1080,
"height": 720
}
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.window@0",
"params": {
"x": 0,
"y": 0,
"width": 1080,
"height": 720
}
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": "null"
}
Provides access to the speeds supported by the stream player.
This property is read-only.
Name | Type | Description |
---|---|---|
(property) | array | Supported speeds (in percentage) |
(property)[#] | integer | (speeds in percentage) |
The stream id shall be passed as the index to the property, e.g. Streamer.1.speeds@0.
Code | Message | Description |
---|---|---|
22 | ERROR_UNKNOWN_KEY |
Unknown stream ID given |
5 | ERROR_ILLEGAL_STATE |
Player is not in a valid state or decoder not attached |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.speeds@0"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": [
0,
100,
-100,
200,
-200,
400,
-400
]
}
Provides access to the all created stream instance IDs.
This property is read-only.
Name | Type | Description |
---|---|---|
(property) | array | Stream IDs |
(property)[#] | number | (a stream ID) |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.streams"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": [
0,
1,
2,
3
]
}
Provides access to the type of a stream.
This property is read-only.
Name | Type | Description |
---|---|---|
(property) | string | Stream type (must be one of the following: undefined, cable, handheld, satellite, terrestrial, dab, rf, unicast, multicast, ip) |
The stream id shall be passed as the index to the property, e.g. Streamer.1.type@0.
Code | Message | Description |
---|---|---|
22 | ERROR_UNKNOWN_KEY |
Unknown stream ID given |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.type@0"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": "cable"
}
Provides access to the DRM type associated with a stream.
This property is read-only.
Also see: drmchange
Name | Type | Description |
---|---|---|
(property) | string | DRM used (must be one of the following: none, clearkey, playready, widevine, unknown) |
The stream id shall be passed as the index to the property, e.g. Streamer.1.drm@0.
Code | Message | Description |
---|---|---|
22 | ERROR_UNKNOWN_KEY |
Unknown stream ID given |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.drm@0"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": "clearkey"
}
Provides access to the current state of a stream.
This property is read-only.
Also see: statechange
Name | Type | Description |
---|---|---|
(property) | string | Stream state (must be one of the following: idle, loading, prepared, controlled, error) |
The stream id shall be passed as the index to the property, e.g. Streamer.1.state@0.
Code | Message | Description |
---|---|---|
22 | ERROR_UNKNOWN_KEY |
Unknown stream ID given |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.state@0"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": "controlled"
}
Provides access to the metadata associated with the stream.
This property is read-only.
Name | Type | Description |
---|---|---|
(property) | string | Custom implementation-specific metadata |
The stream id shall be passed as the index to the property, e.g. Streamer.1.metadata@0.
Code | Message | Description |
---|---|---|
22 | ERROR_UNKNOWN_KEY |
Unknown stream ID given |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.metadata@0"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": ""
}
Provides access to the most recent error code.
This property is read-only.
Name | Type | Description |
---|---|---|
(property) | number | Custom implementation-specific error code value |
The stream id shall be passed as the index to the property, e.g. Streamer.1.error@0.
Code | Message | Description |
---|---|---|
22 | ERROR_UNKNOWN_KEY |
Unknown stream ID given |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.error@0"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": 0
}
Provides access to the stream elements.
This property is read-only.
Name | Type | Description |
---|---|---|
(property) | array | List of stream elements |
(property)[#] | object | Stream element |
(property)[#].type | string | Stream element type (must be one of the following: video, audio, subtitles, teletext, data) |
The stream id shall be passed as the index to the property, e.g. Streamer.1.elements@0.
Code | Message | Description |
---|---|---|
22 | ERROR_UNKNOWN_KEY |
Unknown stream ID given |
2 | ERROR_UNAVAILABLE |
Stream elements retrieval not supported |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Streamer.1.elements@0"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": [
{
"type": "video"
}
]
}
Notifications are autonomous events, triggered by the internals of the plugin, and broadcasted via JSON-RPC to all registered observers. Refer to [Thunder] for information on how to register for a notification.
The following events are provided by the Streamer plugin:
Streamer interface events:
Event | Description |
---|---|
statechange | Notifies of stream state change |
timeupdate | Notifies of stream position change |
stream | Notifies of a custom stream incident |
player | Notifies of a custom player incident |
drm | Notifies of a custom DRM-related incident |
Notifies of stream state change.
Name | Type | Description |
---|---|---|
params | object | |
params.state | string | Stream state (must be one of the following: idle, loading, prepared, controlled, error) |
The Stream ID shall be passed within the designator, e.g. 0.client.events.1.
{
"jsonrpc": "2.0",
"method": "0.client.events.1.statechange",
"params": {
"state": "controlled"
}
}
Notifies of stream position change. This event is fired every second to indicate the current stream position. It does not fire if the stream is paused (i.e. speed is set to 0).
Name | Type | Description |
---|---|---|
params | object | |
params.time | number | Stream position in miliseconds |
The Stream ID shall be passed within the designator, e.g. 0.client.events.1.
{
"jsonrpc": "2.0",
"method": "0.client.events.1.timeupdate",
"params": {
"time": 30000
}
}
Notifies of a custom stream incident.
Name | Type | Description |
---|---|---|
params | object | |
params.code | number | Implementation-specific incident code |
The Stream ID shall be passed within the designator, e.g. 0.client.events.1.
{
"jsonrpc": "2.0",
"method": "0.client.events.1.stream",
"params": {
"code": 1
}
}
Notifies of a custom player incident.
Name | Type | Description |
---|---|---|
params | object | |
params.code | number | Implementation-specific incident code |
The Stream ID shall be passed within the designator, e.g. 0.client.events.1.
{
"jsonrpc": "2.0",
"method": "0.client.events.1.player",
"params": {
"code": 1
}
}
Notifies of a custom DRM-related incident.
Name | Type | Description |
---|---|---|
params | object | |
params.code | number | Implementation-specific incident code |
The Stream ID shall be passed within the designator, e.g. 0.client.events.1.
{
"jsonrpc": "2.0",
"method": "0.client.events.1.drm",
"params": {
"code": 1
}
}