Use underscore in WebSocket API

This commit is contained in:
Rafostar
2020-12-12 20:10:06 +01:00
parent ea7b712b2e
commit 660b5c6c48

View File

@@ -334,7 +334,7 @@ class ClapperPlayer extends PlayerBase
_onStateChanged(player, state) _onStateChanged(player, state)
{ {
this.state = state; this.state = state;
this.emitWs('state-changed', 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,8 +362,8 @@ class ClapperPlayer extends PlayerBase
_onStreamEnded(player) _onStreamEnded(player)
{ {
debug('stream ended'); debug(`end of stream: ${this._trackId}`);
this.emitWs('stream-ended', this._trackId); this.emitWs('end_of_stream', this._trackId);
this._trackId++; this._trackId++;
@@ -645,12 +645,11 @@ class ClapperPlayer extends PlayerBase
_onWsData(server, action, value) _onWsData(server, action, value)
{ {
switch(action) { switch(action) {
case 'toggle-play': case 'toggle_play':
this.toggle_play();
break;
case 'play': case 'play':
case 'pause': case 'pause':
this[action](); case 'set_media':
this[action](value);
break; break;
default: default:
super._onWsData(server, action, value); super._onWsData(server, action, value);