openvidu-browser: check if Filter exists on Stream#applyFilter

pull/715/head
pabloFuente 2022-04-21 13:44:44 +02:00
parent 5826032020
commit 28a6fd4064
1 changed files with 5 additions and 0 deletions

View File

@ -319,6 +319,10 @@ export class Stream {
applyFilter(type: string, options: Object): Promise<Filter> {
return new Promise(async (resolve, reject) => {
if (!!this.filter) {
return reject(new OpenViduError(OpenViduErrorName.GENERIC_ERROR, 'There is already a filter applied to Stream ' + this.streamId));
}
const resolveApplyFilter = (error) => {
if (error) {
logger.error('Error applying filter for Stream ' + this.streamId, error);
@ -477,6 +481,7 @@ export class Stream {
const resolveRemoveFilter = (error) => {
if (error) {
delete this.filter;
logger.error('Error removing filter for Stream ' + this.streamId, error);
if (error.code === 401) {
return reject(new OpenViduError(OpenViduErrorName.OPENVIDU_PERMISSION_DENIED, "You don't have permissions to remove a filter"));