mirror of
https://github.com/Rafostar/clapper.git
synced 2025-09-01 00:41:58 +02:00
Send player state via WebSockets
This commit is contained in:
@@ -334,6 +334,7 @@ class ClapperPlayer extends PlayerBase
|
|||||||
_onStateChanged(player, state)
|
_onStateChanged(player, state)
|
||||||
{
|
{
|
||||||
this.state = state;
|
this.state = state;
|
||||||
|
this.emitWs('state-changed', state);
|
||||||
|
|
||||||
if(state !== GstPlayer.PlayerState.BUFFERING) {
|
if(state !== GstPlayer.PlayerState.BUFFERING) {
|
||||||
let root = player.widget.get_root();
|
let root = player.widget.get_root();
|
||||||
@@ -362,6 +363,8 @@ class ClapperPlayer extends PlayerBase
|
|||||||
_onStreamEnded(player)
|
_onStreamEnded(player)
|
||||||
{
|
{
|
||||||
debug('stream ended');
|
debug('stream ended');
|
||||||
|
this.emitWs('stream-ended', this._trackId);
|
||||||
|
|
||||||
this._trackId++;
|
this._trackId++;
|
||||||
|
|
||||||
if(this._trackId < this._playlist.length)
|
if(this._trackId < this._playlist.length)
|
||||||
|
@@ -181,6 +181,14 @@ class ClapperPlayerBase extends GstPlayer.Player
|
|||||||
this.widget.queue_render();
|
this.widget.queue_render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emitWs(action, value)
|
||||||
|
{
|
||||||
|
if(!this.webserver)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.webserver.sendMessage({ action, value });
|
||||||
|
}
|
||||||
|
|
||||||
_onWsData(server, action, value)
|
_onWsData(server, action, value)
|
||||||
{
|
{
|
||||||
debug(`unhandled WebSocket action: ${action}`);
|
debug(`unhandled WebSocket action: ${action}`);
|
||||||
|
Reference in New Issue
Block a user