Minor updates for Kurento filters support

pull/105/head
pabloFuente 2018-08-01 15:10:46 +02:00
parent c6f80c153a
commit 65c886930f
7 changed files with 39 additions and 11 deletions

View File

@ -492,9 +492,13 @@ export class Session implements EventDispatcher {
});
}
applyFilter(stream: Stream, type: string, options: string): Promise<any> {
applyFilter(stream: Stream, type: string, options: Object): Promise<any> {
return new Promise((resolve, reject) => {
console.info('Applying filter to stream ' + stream.streamId);
options = !!options ? options : {};
if (typeof options !== 'string') {
options = JSON.stringify(options);
}
this.openvidu.sendRequest(
'applyFilter',
{ streamId: stream.streamId, type, options },

View File

@ -29,7 +29,7 @@ export interface Filter {
/**
* Parameters used to initialized the filter.
* These correspond to the constructor parameters used in the filter in Kurento Media Server.
* For example: for `filter.type = "GStreamerFilter"` could be `filter.options = "pitch pitch=0.8 tempo=1.0"`
* For example: for `filter.type = "GStreamerFilter"` could be `filter.options = {"command": "pitch pitch=0.8 tempo=1.0"}`
*/
options?: Object;

View File

@ -35,18 +35,19 @@ public class OpenViduException extends JsonRpcErrorException {
202), ROOM_GENERIC_ERROR_CODE(201),
USER_NOT_STREAMING_ERROR_CODE(105), EXISTING_USER_IN_ROOM_ERROR_CODE(104), USER_CLOSED_ERROR_CODE(
103), USER_NOT_FOUND_ERROR_CODE(102), USER_GENERIC_ERROR_CODE(101),
103), USER_NOT_FOUND_ERROR_CODE(102), USER_GENERIC_ERROR_CODE(10),
USER_UNAUTHORIZED_ERROR_CODE(401), ROLE_NOT_FOUND_ERROR_CODE(402), SESSIONID_CANNOT_BE_CREATED_ERROR_CODE(
403), TOKEN_CANNOT_BE_CREATED_ERROR_CODE(404),
403), TOKEN_CANNOT_BE_CREATED_ERROR_CODE(404), EXISTING_FILTER_ALREADY_APPLIED_ERROR_CODE(405),
FILTER_NOT_APPLIED_ERROR_CODE(406),
USER_METADATA_FORMAT_INVALID_ERROR_CODE(500),
SIGNAL_FORMAT_INVALID_ERROR_CODE(600), SIGNAL_TO_INVALID_ERROR_CODE(601), SIGNAL_MESSAGE_INVALID_ERROR_CODE(
602),
RECORDING_PATH_NOT_VALID(708), RECORDING_FILE_EMPTY_ERROR(707), RECORDING_DELETE_ERROR_CODE(706), RECORDING_LIST_ERROR_CODE(
705), RECORDING_STOP_ERROR_CODE(704), RECORDING_START_ERROR_CODE(
RECORDING_PATH_NOT_VALID(708), RECORDING_FILE_EMPTY_ERROR(707), RECORDING_DELETE_ERROR_CODE(
706), RECORDING_LIST_ERROR_CODE(705), RECORDING_STOP_ERROR_CODE(704), RECORDING_START_ERROR_CODE(
703), RECORDING_REPORT_ERROR_CODE(702), RECORDING_COMPLETION_ERROR_CODE(701);
private int value;

View File

@ -49,6 +49,7 @@ public class ProtocolElements {
public static final String JOINROOM_PEERSTREAMTYPEOFVIDEO_PARAM = "typeOfVideo";
public static final String JOINROOM_PEERSTREAMFRAMERATE_PARAM = "frameRate";
public static final String JOINROOM_PEERSTREAMVIDEODIMENSIONS_PARAM = "videoDimensions";
public static final String JOINROOM_PEERSTREAMFILTER_PARAM = "filter";
public static final String PUBLISHVIDEO_METHOD = "publishVideo";
public static final String PUBLISHVIDEO_SDPOFFER_PARAM = "sdpOffer";
@ -62,6 +63,7 @@ public class ProtocolElements {
public static final String PUBLISHVIDEO_TYPEOFVIDEO_PARAM = "typeOfVideo";
public static final String PUBLISHVIDEO_FRAMERATE_PARAM = "frameRate";
public static final String PUBLISHVIDEO_VIDEODIMENSIONS_PARAM = "videoDimensions";
public static final String PUBLISHVIDEO_KURENTOFILTER_PARAM = "filter";
public static final String UNPUBLISHVIDEO_METHOD = "unpublishVideo";
@ -87,13 +89,31 @@ public class ProtocolElements {
public static final String STREAMPROPERTYCHANGED_PROPERTY_PARAM = "property";
public static final String STREAMPROPERTYCHANGED_NEWVALUE_PARAM = "newValue";
public static final String STREAMPROPERTYCHANGED_REASON_PARAM = "reason";
public static final String FORCEDISCONNECT_METHOD = "forceDisconnect";
public static final String FORCEDISCONNECT_CONNECTIONID_PARAM = "connectionId";
public static final String FORCEUNPUBLISH_METHOD = "forceUnpublish";
public static final String FORCEUNPUBLISH_STREAMID_PARAM = "streamId";
public static final String APPLYFILTER_METHOD = "applyFilter";
public static final String FILTER_STREAMID_PARAM = "streamId";
public static final String FILTER_TYPE_PARAM = "type";
public static final String FILTER_OPTIONS_PARAM = "options";
public static final String FILTER_METHOD_PARAM = "method";
public static final String FILTER_PARAMS_PARAM = "params";
public static final String EXECFILTERMETHOD_METHOD = "execFilterMethod";
public static final String EXECFILTERMETHOD_LASTEXECMETHOD_PARAM = "lastExecMethod";
public static final String REMOVEFILTER_METHOD = "removeFilter";
public static final String FORCEAPPLYFILTER_METHOD = "forceApplyFilter";
public static final String FORCEEXECFILTERMETHOD_METHOD = "forceExecFilterMethod";
public static final String FORCEREMOVEFILTER_METHOD = "forceRemoveFilter";
// ---------------------------- SERVER RESPONSES & EVENTS -----------------
public static final String PARTICIPANTJOINED_METHOD = "participantJoined";
@ -119,6 +139,7 @@ public class ProtocolElements {
public static final String PARTICIPANTPUBLISHED_TYPEOFVIDEO_PARAM = "typeOfVideo";
public static final String PARTICIPANTPUBLISHED_FRAMERATE_PARAM = "frameRate";
public static final String PARTICIPANTPUBLISHED_VIDEODIMENSIONS_PARAM = "videoDimensions";
public static final String PARTICIPANTPUBLISHED_FILTER_PARAM = "filter";
public static final String PARTICIPANTUNPUBLISHED_METHOD = "participantUnpublished";
public static final String PARTICIPANTUNPUBLISHED_NAME_PARAM = "connectionId";

View File

@ -133,7 +133,7 @@ public class Session {
}
kurentoOptions.put("allowedFilters", allowedFilters);
}
json.put("kurentoConfiguration", kurentoOptions);
json.put("kurentoOptions", kurentoOptions);
}
StringEntity params;
try {

View File

@ -97,7 +97,7 @@ export class Session {
session: this.sessionId,
role: (!!tokenOptions && !!tokenOptions.role) ? tokenOptions.role : OpenViduRole.PUBLISHER,
data: (!!tokenOptions && !!tokenOptions.data) ? tokenOptions.data : '',
kurentoConfiguration: (!!tokenOptions && !!tokenOptions.kurentoOptions) ? tokenOptions.kurentoOptions : {},
kurentoOptions: (!!tokenOptions && !!tokenOptions.kurentoOptions) ? tokenOptions.kurentoOptions : {},
});
axios.post(

View File

@ -36,6 +36,8 @@ export interface TokenOptions {
role?: OpenViduRole;
/**
* **WARNING**: experimental option. This interface may change in the near future
*
* Some advanced properties setting the configuration that the WebRTC streams of the user owning the token will have in Kurento Media Server.
* You can adjust:
* - `videoMaxRecvBandwidth`: maximum number of Kbps that the client owning the token will be able to receive from Kurento Media Server. 0 means unconstrained. Giving a value to this property will override