mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: force filter operations for moderators
parent
86f50bdeaf
commit
b9f51ab40a
|
@ -137,7 +137,7 @@ export class Filter {
|
|||
console.info('Adding filter event listener to event ' + eventType + ' to stream ' + this.stream.streamId);
|
||||
this.stream.session.openvidu.sendRequest(
|
||||
'addFilterEventListener',
|
||||
{ streamId: this.stream.streamId, type: eventType },
|
||||
{ streamId: this.stream.streamId, eventType },
|
||||
(error, response) => {
|
||||
if (error) {
|
||||
console.error('Error adding filter event listener to event ' + eventType + 'for Stream ' + this.stream.streamId, error);
|
||||
|
@ -169,7 +169,7 @@ export class Filter {
|
|||
console.info('Removing filter event listener to event ' + eventType + ' to stream ' + this.stream.streamId);
|
||||
this.stream.session.openvidu.sendRequest(
|
||||
'removeFilterEventListener',
|
||||
{ streamId: this.stream.streamId, type: eventType },
|
||||
{ streamId: this.stream.streamId, eventType },
|
||||
(error, response) => {
|
||||
if (error) {
|
||||
console.error('Error removing filter event listener to event ' + eventType + 'for Stream ' + this.stream.streamId, error);
|
||||
|
|
|
@ -771,10 +771,8 @@ export class Session implements EventDispatcher {
|
|||
* @hidden
|
||||
*/
|
||||
onStreamPropertyChanged(msg): void {
|
||||
this.getRemoteConnection(msg.connectionId, 'Remote connection ' + msg.connectionId + " unknown when 'onStreamPropertyChanged'. " +
|
||||
'Existing remote connections: ' + JSON.stringify(Object.keys(this.remoteConnections)))
|
||||
|
||||
.then(connection => {
|
||||
const callback = (connection: Connection) => {
|
||||
if (!!connection.stream && connection.stream.streamId === msg.streamId) {
|
||||
const stream = connection.stream;
|
||||
let oldValue;
|
||||
|
@ -809,17 +807,27 @@ export class Session implements EventDispatcher {
|
|||
msg.newValue = stream.filter;
|
||||
break;
|
||||
}
|
||||
|
||||
this.ee.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent(this, stream, msg.property, msg.newValue, oldValue, msg.reason)]);
|
||||
stream.streamManager.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent(stream.streamManager, stream, msg.property, msg.newValue, oldValue, msg.reason)]);
|
||||
} else {
|
||||
console.error("No stream with streamId '" + msg.streamId + "' found for connection '" + msg.connectionId + "' on 'streamPropertyChanged' event");
|
||||
}
|
||||
};
|
||||
|
||||
if (msg.connectionId === this.connection.connectionId) {
|
||||
// Your stream has been forcedly changed (filter feature)
|
||||
callback(this.connection);
|
||||
} else {
|
||||
this.getRemoteConnection(msg.connectionId, 'Remote connection ' + msg.connectionId + " unknown when 'onStreamPropertyChanged'. " +
|
||||
'Existing remote connections: ' + JSON.stringify(Object.keys(this.remoteConnections)))
|
||||
.then(connection => {
|
||||
callback(connection);
|
||||
})
|
||||
.catch(openViduError => {
|
||||
console.error(openViduError);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
|
|
Loading…
Reference in New Issue