/* Autogenerated with Kurento Idl */
/*
* (C) Copyright 2013-2015 Kurento (https://kurento.openvidu.io/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var inherits = require('inherits');
var kurentoClient = require('kurento-client');
var disguise = kurentoClient.disguise;
var checkType = kurentoClient.checkType;
var ChecktypeError = checkType.ChecktypeError;
var Transaction = kurentoClient.TransactionsManager.Transaction;
var Filter = require('kurento-client-core').abstracts.Filter;
function noop(error, result) {
if (error) console.trace(error);
return result
};
/**
* ImageOverlayFilter interface. This type of {@link Filter} draws an image in a
*
* @classdesc
* ImageOverlayFilter interface. This type of {@link Filter} draws an image in
* a configured position over a video feed.
*
* @extends module:core/abstracts.Filter
*
* @constructor module:filters.ImageOverlayFilter
*/
function ImageOverlayFilter(){
ImageOverlayFilter.super_.call(this);
};
inherits(ImageOverlayFilter, Filter);
//
// Public methods
//
/**
* Add an image to be used as overlay.
*
* @alias module:filters.ImageOverlayFilter.addImage
*
* @param {external:String} id
* image ID
*
* @param {external:String} uri
* URI where the image is located
*
* @param {external:Number} offsetXPercent
* Percentage relative to the image width to calculate the X coordinate of the
* position (left upper corner) [0..1]
*
* @param {external:Number} offsetYPercent
* Percentage relative to the image height to calculate the Y coordinate of the
*
* @param {external:Number} widthPercent
* Proportional width of the overlaid image, relative to the width of the video
*
* @param {external:Number} heightPercent
* Proportional height of the overlaid image, relative to the height of the
* video [0..1].
*
* @param {external:Boolean} keepAspectRatio
* Keep the aspect ratio of the original image.
*
* @param {external:Boolean} center
* If the image doesn't fit in the dimensions, the image will be center into
* the region defined by height and width.
*
* @param {module:filters.ImageOverlayFilter~addImageCallback} [callback]
*
* @return {external:Promise}
*/
ImageOverlayFilter.prototype.addImage = function(id, uri, offsetXPercent, offsetYPercent, widthPercent, heightPercent, keepAspectRatio, center, callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
//
// checkType('String', 'id', id, {required: true});
//
// checkType('String', 'uri', uri, {required: true});
//
// checkType('float', 'offsetXPercent', offsetXPercent, {required: true});
//
// checkType('float', 'offsetYPercent', offsetYPercent, {required: true});
//
// checkType('float', 'widthPercent', widthPercent, {required: true});
//
// checkType('float', 'heightPercent', heightPercent, {required: true});
//
// checkType('boolean', 'keepAspectRatio', keepAspectRatio, {required: true});
//
// checkType('boolean', 'center', center, {required: true});
//
var params = {
id: id,
uri: uri,
offsetXPercent: offsetXPercent,
offsetYPercent: offsetYPercent,
widthPercent: widthPercent,
heightPercent: heightPercent,
keepAspectRatio: keepAspectRatio,
center: center
};
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'addImage', params, callback), this)
};
/**
* @callback module:filters.ImageOverlayFilter~addImageCallback
* @param {external:Error} error
*/
/**
* Remove the image with the given ID.
*
* @alias module:filters.ImageOverlayFilter.removeImage
*
* @param {external:String} id
* Image ID to be removed
*
* @param {module:filters.ImageOverlayFilter~removeImageCallback} [callback]
*
* @return {external:Promise}
*/
ImageOverlayFilter.prototype.removeImage = function(id, callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
//
// checkType('String', 'id', id, {required: true});
//
var params = {
id: id
};
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'removeImage', params, callback), this)
};
/**
* @callback module:filters.ImageOverlayFilter~removeImageCallback
* @param {external:Error} error
*/
/**
* @alias module:filters.ImageOverlayFilter.constructorParams
*
* @property {module:core.MediaPipeline} mediaPipeline
* pipeline to which this {@link Filter} belongs
*/
ImageOverlayFilter.constructorParams = {
mediaPipeline: {
type: 'kurento.MediaPipeline',
required: true
}
};
/**
* @alias module:filters.ImageOverlayFilter.events
*
* @extends module:core/abstracts.Filter.events
*/
ImageOverlayFilter.events = Filter.events;
/**
* Checker for {@link module:filters.ImageOverlayFilter}
*
* @memberof module:filters
*
* @param {external:String} key
* @param {module:filters.ImageOverlayFilter} value
*/
function checkImageOverlayFilter(key, value)
{
if(!(value instanceof ImageOverlayFilter))
throw ChecktypeError(key, ImageOverlayFilter, value);
};
module.exports = ImageOverlayFilter;
ImageOverlayFilter.check = checkImageOverlayFilter;