openvidu-testapp: filter dialog response if no filter applied

pull/108/merge
pabloFuente 2018-08-28 11:50:37 +02:00
parent 9a5920b102
commit eab141fcde
4 changed files with 27 additions and 20 deletions

View File

@ -109,10 +109,10 @@ export class Session implements EventDispatcher {
/** /**
* Connects to the session using `token`. Parameter `metadata` allows you to pass extra data to share with other users when * Connects to the session using `token`. Parameter `metadata` allows you to pass extra data to share with other users when
* they receive `streamCreated` event. The structure of `metadata` string is up to you (maybe some standarized format * they receive `streamCreated` event. The structure of `metadata` string is up to you (maybe some standardized format
* as JSON or XML is a good idea), the only restriction is a maximum length of 10000 chars. * as JSON or XML is a good idea), the only restriction is a maximum length of 10000 chars.
* *
* This metadata is not considered secure, as it is generated in the client side. To pass securized data, add it as a parameter in the * This metadata is not considered secure, as it is generated in the client side. To pass secure data, add it as a parameter in the
* token generation operation (through the API REST, openvidu-java-client or openvidu-node-client). * token generation operation (through the API REST, openvidu-java-client or openvidu-node-client).
* *
* Only after the returned Promise is successfully resolved [[Session.connection]] object will be available and properly defined. * Only after the returned Promise is successfully resolved [[Session.connection]] object will be available and properly defined.
@ -612,7 +612,7 @@ export class Session implements EventDispatcher {
if (type === 'publisherStartSpeaking' || type === 'publisherStopSpeaking') { if (type === 'publisherStartSpeaking' || type === 'publisherStopSpeaking') {
this.speakingEventsEnabled = false; this.speakingEventsEnabled = false;
// If there are already available remote streams, disablae hark in all of them // If there are already available remote streams, disable hark in all of them
for (const connectionId in this.remoteConnections) { for (const connectionId in this.remoteConnections) {
const str = this.remoteConnections[connectionId].stream; const str = this.remoteConnections[connectionId].stream;
if (!!str && !!str.speechEvent) { if (!!str && !!str.speechEvent) {

View File

@ -259,7 +259,6 @@ export class Stream implements EventDispatcher {
/** /**
*
* Applies an audio/video filter to the stream. * Applies an audio/video filter to the stream.
* *
* @param type Type of filter applied. See [[Filter.type]] * @param type Type of filter applied. See [[Filter.type]]

View File

@ -369,7 +369,6 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
throw new OpenViduException(Code.USER_UNAUTHORIZED_ERROR_CODE, throw new OpenViduException(Code.USER_UNAUTHORIZED_ERROR_CODE,
"Unable to force unpublish. The user does not have a valid token"); "Unable to force unpublish. The user does not have a valid token");
} }
} }
private void applyFilter(RpcConnection rpcConnection, Request<JsonObject> request) { private void applyFilter(RpcConnection rpcConnection, Request<JsonObject> request) {

View File

@ -54,6 +54,7 @@ export class FilterDialogComponent {
}); });
} else { } else {
console.warn('No filter applied to stream ' + this.stream.streamId); console.warn('No filter applied to stream ' + this.stream.streamId);
this.response = 'Error [Stream ' + this.stream.streamId + ' has no filter applied in session]';
} }
} }
@ -70,6 +71,7 @@ export class FilterDialogComponent {
subFilterEvent() { subFilterEvent() {
console.log('Adding filter event'); console.log('Adding filter event');
if (!!this.stream.filter) {
this.stream.filter.addEventListener(this.eventType, (event: FilterEvent) => { this.stream.filter.addEventListener(this.eventType, (event: FilterEvent) => {
this.filterEventHandler(event); this.filterEventHandler(event);
}) })
@ -79,10 +81,14 @@ export class FilterDialogComponent {
.catch(error => { .catch(error => {
this.response = 'Error [' + error.message + ']'; this.response = 'Error [' + error.message + ']';
}); });
} else {
this.response = 'Error [Stream ' + this.stream.streamId + ' has no filter applied in session]';
}
} }
unsubFilterEvent() { unsubFilterEvent() {
console.log('Removing filter event'); console.log('Removing filter event');
if (!!this.stream.filter) {
this.stream.filter.removeEventListener(this.eventType) this.stream.filter.removeEventListener(this.eventType)
.then(() => { .then(() => {
this.response = 'Filter event listener removed'; this.response = 'Filter event listener removed';
@ -90,6 +96,9 @@ export class FilterDialogComponent {
.catch(error => { .catch(error => {
this.response = 'Error [' + error.message + ']'; this.response = 'Error [' + error.message + ']';
}); });
} else {
this.response = 'Error [Stream ' + this.stream.streamId + ' has no filter applied in session]';
}
} }
} }