Host
A class in charge of communicating back and forth with the native app.
There should be no need to modify/extend this class as it uses Playback to build the messages to send and as the receiver of all messages from the MPRIS2 interfase
Constructor Summary
Public Constructor | ||
public |
constructor(playback: Playback, carrier: Carrier, port: Object) |
Member Summary
Public Members | ||
public |
A carrier for caching and building the payloads |
|
public |
The playback to interact with |
|
public |
A chrome.runtime.Port |
|
public |
The default Payload.Identity for the MPRIS2 Interface |
Method Summary
Public Methods | ||
public |
change() Send a change message to host app |
|
public |
command(name: MessageMethod) Native application wants to run a command on playback |
|
public |
get(_: string, propName: MessageProperty): number | void Native application wants to Get a property from client |
|
public |
messageListener(request: Object) Listener for messages from native application (aka: mpris interface) |
|
public |
quit() Send a quit message to host |
|
public |
return(method: MessageMethod, args: *) |
|
public |
Send a seeked message to host |
|
public |
sendMessage(type: MessageType, payload: Object | number) Send a message to host app |
|
public |
set(_: string, propName: MessageProperty, newValue: number | LoopStatus | boolean) Native application wants to Set a property in the client. |
|
public |
Set player as active player and send data to native app |
Public Constructors
Public Methods
public command(name: MessageMethod) source
Native application wants to run a command on playback
Params:
Name | Type | Attribute | Description |
name | MessageMethod |
public get(_: string, propName: MessageProperty): number | void source
Native application wants to Get a property from client
Params:
Name | Type | Attribute | Description |
_ | string | org.mpris.MediaPlayer2.Player |
|
propName | MessageProperty | property that should be returned |
public messageListener(request: Object) source
Listener for messages from native application (aka: mpris interface)
Params:
Name | Type | Attribute | Description |
request | Object | ||
request.method | MessageMethod | ||
request.args | Array |
public return(method: MessageMethod, args: *) source
Params:
Name | Type | Attribute | Description |
method | MessageMethod | ||
args | * |
public seeked(player: Player) source
Send a seeked message to host
Params:
Name | Type | Attribute | Description |
player | Player |
public sendMessage(type: MessageType, payload: Object | number) source
Send a message to host app
Params:
Name | Type | Attribute | Description |
type | MessageType | ||
payload | Object | number |
|
public set(_: string, propName: MessageProperty, newValue: number | LoopStatus | boolean) source
Native application wants to Set a property in the client.
Params:
Name | Type | Attribute | Description |
_ | string | org.mpris.MediaPlayer2.Player |
|
propName | MessageProperty | property to set |
|
newValue | number | LoopStatus | boolean |
|
depends on the property to set |