Clapper.Server

g Clapper.Feature Clapper.Feature Clapper.Server Clapper.Server Clapper.Feature->Clapper.Server GObject.InitiallyUnowned GObject.InitiallyUnowned Gst.Object Gst.Object GObject.InitiallyUnowned->Gst.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gst.Object->Clapper.Feature

Subclasses:

None

Methods

Inherited:

Gst.Object (27), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

get_current_port ()

get_enabled ()

get_port ()

get_queue_controllable ()

get_running ()

set_enabled (enabled)

set_port (port)

set_queue_controllable (controllable)

Virtual Methods

Inherited:

Clapper.Feature (15), Gst.Object (1), GObject.Object (7)

Properties

Inherited:

Gst.Object (2)

Name

Type

Flags

Short Description

current-port

int

r/en

enabled

bool

r/w/en

port

int

r/w/en

queue-controllable

bool

r/w/en

running

bool

r/en

Signals

Inherited:

Gst.Object (1), GObject.Object (1)

Name

Short Description

error

Error signal when server could not start.

Fields

Inherited:

Gst.Object (1), GObject.Object (1)

Class Details

class Clapper.Server(**kwargs)
Bases:

Clapper.Feature

Abstract:

No

Structure:

Clapper.ServerClass

An optional Server feature to add to the player.

Clapper.Server is a feature that hosts a local server providing an ability to both monitor and control playback through WebSocket messages and HTTP requests.

Use [const`Clapper`.HAVE_SERVER] macro to check if Clapper API was compiled with this feature.

classmethod new()
Returns:

a new Clapper.Server instance.

Return type:

Clapper.Server

Creates a new Clapper.Server instance.

get_current_port()
Returns:

Current listening port or 0 if server is not listening.

Return type:

int

Get port on which server is currently listening on.

get_enabled()
Returns:

True if enabled, False otherwise.

Return type:

bool

Get whether Clapper.Server is set to be running.

get_port()
Returns:

Requested listening port or 0 when using random port.

Return type:

int

Get requested server listening port.

If you want to know the port server is currently listening on, use [method`Clapper`.Server.get_current_port] instead.

get_queue_controllable()
Returns:

True if control over Clapper.Queue is allowed, False otherwise.

Return type:

bool

Get whether remote self clients can control [class`Clapper`.Queue].

get_running()
Returns:

True if running, False otherwise.

Return type:

bool

Get whether Clapper.Server is currently running.

set_enabled(enabled)
Parameters:

enabled (bool) – if Clapper.Server should run

Set whether Clapper.Server should be running.

Note that server feature will run only after being added to the player. It can be however set to enabled earlier. If server was already added, changing this property allows to start/stop server at any time.

To be notified when server is actually running/stopped after being enabled/disabled, you can listen for changes to [property`Clapper`.Server:running] property.

set_port(port)
Parameters:

port (int) – a port number or 0 for random free port

Set server listening port.

set_queue_controllable(controllable)
Parameters:

controllable (bool) – if Clapper.Queue should be controllable

Set whether remote self clients can control [class`Clapper`.Queue].

This includes ability to add/remove items from the queue and selecting current item for playback remotely using WebSocket messages.

You probably want to keep this disabled if your application is supposed to manage what is played now and not WebSocket client.

Signal Details

Clapper.Server.signals.error(server, error)
Signal Name:

error

Flags:

RUN_LAST, NO_RECURSE, NO_HOOKS

Parameters:

Error signal when server could not start. This will be emitted from application main thread.

Property Details

Clapper.Server.props.current_port
Name:

current-port

Type:

int

Default Value:

0

Flags:

READABLE, EXPLICIT_NOTIFY

Port on which server is currently listening on or 0 if not listening.

Clapper.Server.props.enabled
Name:

enabled

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether server is enabled.

Clapper.Server.props.port
Name:

port

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Port to listen on or 0 for using random unused port.

Clapper.Server.props.queue_controllable
Name:

queue-controllable

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether remote server clients can control Clapper.Queue.

Clapper.Server.props.running
Name:

running

Type:

bool

Default Value:

False

Flags:

READABLE, EXPLICIT_NOTIFY

Whether server is currently running.