openvidu-browser: lib compilation folder removed from repo

pull/203/head
pabloFuente 2019-01-22 15:38:12 +01:00
parent 3a5b24ef72
commit 05b825c43e
143 changed files with 1 additions and 9208 deletions

View File

@ -4,7 +4,7 @@ var __extends = (this && this.__extends) || (function () {
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }

View File

@ -1,60 +0,0 @@
import { Session } from './Session';
import { Stream } from './Stream';
import { ConnectionOptions } from '../OpenViduInternal/Interfaces/Private/ConnectionOptions';
import { StreamOptionsServer } from '../OpenViduInternal/Interfaces/Private/StreamOptionsServer';
/**
* Represents each one of the user's connection to the session (the local one and other user's connections).
* Therefore each [[Session]] and [[Stream]] object has an attribute of type Connection
*/
export declare class Connection {
private session;
/**
* Unique identifier of the connection
*/
connectionId: string;
/**
* Time when this connection was created (UTC milliseconds)
*/
creationTime: number;
/**
* Data associated to this connection (and therefore to certain user). This is an important field:
* it allows you to broadcast all the information you want for each user (a username, for example)
*/
data: string;
/**
* @hidden
*/
stream: Stream;
/**
* @hidden
*/
options: ConnectionOptions | undefined;
/**
* @hidden
*/
disposed: boolean;
/**
* @hidden
*/
constructor(session: Session, opts?: ConnectionOptions);
/**
* @hidden
*/
sendIceCandidate(candidate: RTCIceCandidate): void;
/**
* @hidden
*/
initRemoteStreams(options: StreamOptionsServer[]): void;
/**
* @hidden
*/
addStream(stream: Stream): void;
/**
* @hidden
*/
removeStream(streamId: string): void;
/**
* @hidden
*/
dispose(): void;
}

View File

@ -1,123 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
var Stream_1 = require("./Stream");
/**
* Represents each one of the user's connection to the session (the local one and other user's connections).
* Therefore each [[Session]] and [[Stream]] object has an attribute of type Connection
*/
var Connection = /** @class */ (function () {
/**
* @hidden
*/
function Connection(session, opts) {
this.session = session;
/**
* @hidden
*/
this.disposed = false;
var msg = "'Connection' created ";
if (!!opts) {
msg += "(remote) with 'connectionId' [" + opts.id + ']';
}
else {
msg += '(local)';
}
console.info(msg);
this.options = opts;
if (!!opts) {
// Connection is remote
this.connectionId = opts.id;
if (opts.metadata) {
this.data = opts.metadata;
}
if (opts.streams) {
this.initRemoteStreams(opts.streams);
}
}
this.creationTime = new Date().getTime();
}
/* Hidden methods */
/**
* @hidden
*/
Connection.prototype.sendIceCandidate = function (candidate) {
console.debug((!!this.stream.outboundStreamOpts ? 'Local' : 'Remote'), 'candidate for', this.connectionId, JSON.stringify(candidate));
this.session.openvidu.sendRequest('onIceCandidate', {
endpointName: this.connectionId,
candidate: candidate.candidate,
sdpMid: candidate.sdpMid,
sdpMLineIndex: candidate.sdpMLineIndex
}, function (error, response) {
if (error) {
console.error('Error sending ICE candidate: '
+ JSON.stringify(error));
}
});
};
/**
* @hidden
*/
Connection.prototype.initRemoteStreams = function (options) {
var _this = this;
// This is ready for supporting multiple streams per Connection object. Right now the loop will always run just once
// this.stream should also be replaced by a collection of streams to support multiple streams per Connection
options.forEach(function (opts) {
var streamOptions = {
id: opts.id,
connection: _this,
hasAudio: opts.hasAudio,
hasVideo: opts.hasVideo,
audioActive: opts.audioActive,
videoActive: opts.videoActive,
typeOfVideo: opts.typeOfVideo,
frameRate: opts.frameRate,
videoDimensions: !!opts.videoDimensions ? JSON.parse(opts.videoDimensions) : undefined,
filter: !!opts.filter ? opts.filter : undefined
};
var stream = new Stream_1.Stream(_this.session, streamOptions);
_this.addStream(stream);
});
console.info("Remote 'Connection' with 'connectionId' [" + this.connectionId + '] is now configured for receiving Streams with options: ', this.stream.inboundStreamOpts);
};
/**
* @hidden
*/
Connection.prototype.addStream = function (stream) {
stream.connection = this;
this.stream = stream;
};
/**
* @hidden
*/
Connection.prototype.removeStream = function (streamId) {
delete this.stream;
};
/**
* @hidden
*/
Connection.prototype.dispose = function () {
if (!!this.stream) {
delete this.stream;
}
this.disposed = true;
};
return Connection;
}());
exports.Connection = Connection;
//# sourceMappingURL=Connection.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Connection.js","sourceRoot":"","sources":["../../src/OpenVidu/Connection.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAGH,mCAAkC;AAMlC;;;GAGG;AACH;IAiCI;;OAEG;IACH,oBAAoB,OAAgB,EAAE,IAAwB;QAA1C,YAAO,GAAP,OAAO,CAAS;QARpC;;WAEG;QACH,aAAQ,GAAG,KAAK,CAAC;QAOb,IAAI,GAAG,GAAG,uBAAuB,CAAC;QAClC,IAAI,CAAC,CAAC,IAAI,EAAE;YACR,GAAG,IAAI,gCAAgC,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;SAC3D;aAAM;YACH,GAAG,IAAI,SAAS,CAAC;SACpB;QACD,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAElB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QAEpB,IAAI,CAAC,CAAC,IAAI,EAAE;YACR,uBAAuB;YACvB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,CAAC;YAC5B,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC;aAC7B;YACD,IAAI,IAAI,CAAC,OAAO,EAAE;gBACd,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aACxC;SACJ;QAED,IAAI,CAAC,YAAY,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;IAC7C,CAAC;IAGD,oBAAoB;IAEpB;;OAEG;IACH,qCAAgB,GAAhB,UAAiB,SAA0B;QAEvC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,eAAe,EAClF,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;QAElD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,gBAAgB,EAAE;YAChD,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,SAAS,EAAE,SAAS,CAAC,SAAS;YAC9B,MAAM,EAAE,SAAS,CAAC,MAAM;YACxB,aAAa,EAAE,SAAS,CAAC,aAAa;SACzC,EAAE,UAAC,KAAK,EAAE,QAAQ;YACf,IAAI,KAAK,EAAE;gBACP,OAAO,CAAC,KAAK,CAAC,+BAA+B;sBACvC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;aAChC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,sCAAiB,GAAjB,UAAkB,OAA8B;QAAhD,iBAuBC;QArBG,oHAAoH;QACpH,4GAA4G;QAC5G,OAAO,CAAC,OAAO,CAAC,UAAA,IAAI;YAChB,IAAM,aAAa,GAAyB;gBACxC,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,UAAU,EAAE,KAAI;gBAChB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,SAAS;gBACtF,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;aAClD,CAAC;YACF,IAAM,MAAM,GAAG,IAAI,eAAM,CAAC,KAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;YAEvD,KAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,IAAI,CAAC,2CAA2C,GAAG,IAAI,CAAC,YAAY,GAAG,0DAA0D,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC9K,CAAC;IAED;;OAEG;IACH,8BAAS,GAAT,UAAU,MAAc;QACpB,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,iCAAY,GAAZ,UAAa,QAAgB;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,4BAAO,GAAP;QACI,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE;YACf,OAAO,IAAI,CAAC,MAAM,CAAC;SACtB;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACzB,CAAC;IAEL,iBAAC;AAAD,CAAC,AA3ID,IA2IC;AA3IY,gCAAU"}

View File

@ -1,73 +0,0 @@
import { Stream } from './Stream';
import { FilterEvent } from '../OpenViduInternal/Events/FilterEvent';
import { ObjMap } from '../OpenViduInternal/Interfaces/Private/ObjMap';
/**
* **WARNING**: experimental option. This interface may change in the near future
*
* Video/audio filter applied to a Stream. See [[Stream.applyFilter]]
*/
export declare class Filter {
/**
* Type of filter applied. This is the name of the remote class identifying the filter to apply in Kurento Media Server.
* For example: `"FaceOverlayFilter"`, `"GStreamerFilter"`.
*
* You can get this property in `*.kmd.json` files defining the Kurento filters. For example, for GStreamerFilter that's
* [here](https://github.com/Kurento/kms-filters/blob/53a452fac71d61795952e3d2202156c6b00f6d65/src/server/interface/filters.GStreamerFilter.kmd.json#L4)
*/
type: string;
/**
* Parameters used to initialize the filter.
* These correspond to the constructor parameters used in the filter in Kurento Media Server (except for `mediaPipeline` parameter, which is never needed).
*
* For example: for `filter.type = "GStreamerFilter"` could be `filter.options = {"command": "videobalance saturation=0.0"}`
*
* You can get this property in `*.kmd.json` files defining the Kurento filters. For example, for GStreamerFilter that's
* [here](https://github.com/Kurento/kms-filters/blob/53a452fac71d61795952e3d2202156c6b00f6d65/src/server/interface/filters.GStreamerFilter.kmd.json#L13-L31)
*/
options: Object;
/**
* Value passed the last time [[Filter.execMethod]] was called. If `undefined` this method has not been called yet.
*
* You can use this value to know the current status of any applied filter
*/
lastExecMethod?: {
method: string;
params: Object;
};
/**
* @hidden
*/
handlers: ObjMap<(event: FilterEvent) => void>;
/**
* @hidden
*/
stream: Stream;
/**
* @hidden
*/
constructor(type: string, options: Object);
/**
* Executes a filter method. Available methods are specific for each filter
*
* @param method Name of the method
* @param params Parameters of the method
*/
execMethod(method: string, params: Object): Promise<any>;
/**
* Subscribe to certain filter event. Available events are specific for each filter
*
* @param eventType Event to which subscribe to.
* @param handler Function to execute upon event dispatched. It receives as parameter a [[FilterEvent]] object
*
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the event listener was successfully attached to the filter and rejected with an Error object if not
*/
addEventListener(eventType: string, handler: (event: FilterEvent) => void): Promise<any>;
/**
* Removes certain filter event listener previously set.
*
* @param eventType Event to unsubscribe from.
*
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the event listener was successfully removed from the filter and rejected with an Error object in other case
*/
removeEventListener(eventType: string): Promise<any>;
}

View File

@ -1,145 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
var StreamPropertyChangedEvent_1 = require("../OpenViduInternal/Events/StreamPropertyChangedEvent");
var OpenViduError_1 = require("../OpenViduInternal/Enums/OpenViduError");
/**
* **WARNING**: experimental option. This interface may change in the near future
*
* Video/audio filter applied to a Stream. See [[Stream.applyFilter]]
*/
var Filter = /** @class */ (function () {
/**
* @hidden
*/
function Filter(type, options) {
/**
* @hidden
*/
this.handlers = {};
this.type = type;
this.options = options;
}
/**
* Executes a filter method. Available methods are specific for each filter
*
* @param method Name of the method
* @param params Parameters of the method
*/
Filter.prototype.execMethod = function (method, params) {
var _this = this;
return new Promise(function (resolve, reject) {
console.info('Executing filter method to stream ' + _this.stream.streamId);
var stringParams;
if (typeof params !== 'string') {
try {
stringParams = JSON.stringify(params);
}
catch (error) {
var errorMsg = "'params' property must be a JSON formatted object";
console.error(errorMsg);
reject(errorMsg);
}
}
else {
stringParams = params;
}
_this.stream.session.openvidu.sendRequest('execFilterMethod', { streamId: _this.stream.streamId, method: method, params: stringParams }, function (error, response) {
if (error) {
console.error('Error executing filter method for Stream ' + _this.stream.streamId, error);
if (error.code === 401) {
reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.OPENVIDU_PERMISSION_DENIED, "You don't have permissions to execute a filter method"));
}
else {
reject(error);
}
}
else {
console.info('Filter method successfully executed on Stream ' + _this.stream.streamId);
var oldValue = Object.assign({}, _this.stream.filter);
_this.stream.filter.lastExecMethod = { method: method, params: JSON.parse(stringParams) };
_this.stream.session.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent_1.StreamPropertyChangedEvent(_this.stream.session, _this.stream, 'filter', _this.stream.filter, oldValue, 'execFilterMethod')]);
_this.stream.streamManager.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent_1.StreamPropertyChangedEvent(_this.stream.streamManager, _this.stream, 'filter', _this.stream.filter, oldValue, 'execFilterMethod')]);
resolve();
}
});
});
};
/**
* Subscribe to certain filter event. Available events are specific for each filter
*
* @param eventType Event to which subscribe to.
* @param handler Function to execute upon event dispatched. It receives as parameter a [[FilterEvent]] object
*
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the event listener was successfully attached to the filter and rejected with an Error object if not
*/
Filter.prototype.addEventListener = function (eventType, handler) {
var _this = this;
return new Promise(function (resolve, reject) {
console.info('Adding filter event listener to event ' + eventType + ' to stream ' + _this.stream.streamId);
_this.stream.session.openvidu.sendRequest('addFilterEventListener', { streamId: _this.stream.streamId, eventType: eventType }, function (error, response) {
if (error) {
console.error('Error adding filter event listener to event ' + eventType + 'for Stream ' + _this.stream.streamId, error);
if (error.code === 401) {
reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.OPENVIDU_PERMISSION_DENIED, "You don't have permissions to add a filter event listener"));
}
else {
reject(error);
}
}
else {
_this.handlers[eventType] = handler;
console.info('Filter event listener to event ' + eventType + ' successfully applied on Stream ' + _this.stream.streamId);
resolve();
}
});
});
};
/**
* Removes certain filter event listener previously set.
*
* @param eventType Event to unsubscribe from.
*
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the event listener was successfully removed from the filter and rejected with an Error object in other case
*/
Filter.prototype.removeEventListener = function (eventType) {
var _this = this;
return new Promise(function (resolve, reject) {
console.info('Removing filter event listener to event ' + eventType + ' to stream ' + _this.stream.streamId);
_this.stream.session.openvidu.sendRequest('removeFilterEventListener', { streamId: _this.stream.streamId, eventType: eventType }, function (error, response) {
if (error) {
console.error('Error removing filter event listener to event ' + eventType + 'for Stream ' + _this.stream.streamId, error);
if (error.code === 401) {
reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.OPENVIDU_PERMISSION_DENIED, "You don't have permissions to add a filter event listener"));
}
else {
reject(error);
}
}
else {
delete _this.handlers[eventType];
console.info('Filter event listener to event ' + eventType + ' successfully removed on Stream ' + _this.stream.streamId);
resolve();
}
});
});
};
return Filter;
}());
exports.Filter = Filter;
//# sourceMappingURL=Filter.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Filter.js","sourceRoot":"","sources":["../../src/OpenVidu/Filter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAIH,oGAAmG;AACnG,yEAA2F;AAI3F;;;;GAIG;AACH;IA0CI;;OAEG;IACH,gBAAY,IAAY,EAAE,OAAe;QAdzC;;WAEG;QACH,aAAQ,GAAyC,EAAE,CAAC;QAYhD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAGD;;;;;OAKG;IACH,2BAAU,GAAV,UAAW,MAAc,EAAE,MAAc;QAAzC,iBAqCC;QApCG,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YAC/B,OAAO,CAAC,IAAI,CAAC,oCAAoC,GAAG,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC1E,IAAI,YAAY,CAAC;YACjB,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;gBAC5B,IAAI;oBACA,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;iBACzC;gBAAC,OAAO,KAAK,EAAE;oBACZ,IAAM,QAAQ,GAAG,mDAAmD,CAAC;oBACrE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;oBACxB,MAAM,CAAC,QAAQ,CAAC,CAAC;iBACpB;aACJ;iBAAM;gBACH,YAAY,GAAW,MAAM,CAAC;aACjC;YACD,KAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CACpC,kBAAkB,EAClB,EAAE,QAAQ,EAAE,KAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,QAAA,EAAE,MAAM,EAAE,YAAY,EAAE,EAChE,UAAC,KAAK,EAAE,QAAQ;gBACZ,IAAI,KAAK,EAAE;oBACP,OAAO,CAAC,KAAK,CAAC,2CAA2C,GAAG,KAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;oBACzF,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE;wBACpB,MAAM,CAAC,IAAI,6BAAa,CAAC,iCAAiB,CAAC,0BAA0B,EAAE,uDAAuD,CAAC,CAAC,CAAC;qBACpI;yBAAM;wBACH,MAAM,CAAC,KAAK,CAAC,CAAC;qBACjB;iBACJ;qBAAM;oBACH,OAAO,CAAC,IAAI,CAAC,gDAAgD,GAAG,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;oBACtF,IAAM,QAAQ,GAAS,MAAO,CAAC,MAAM,CAAC,EAAE,EAAE,KAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;oBAC9D,KAAI,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,GAAG,EAAE,MAAM,QAAA,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;oBACjF,KAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,uBAAuB,EAAE,CAAC,IAAI,uDAA0B,CAAC,KAAI,CAAC,MAAM,CAAC,OAAO,EAAE,KAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAI,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;oBACvL,KAAI,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,uBAAuB,EAAE,CAAC,IAAI,uDAA0B,CAAC,KAAI,CAAC,MAAM,CAAC,aAAa,EAAE,KAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAI,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;oBACnM,OAAO,EAAE,CAAC;iBACb;YACL,CAAC,CACJ,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;IAGD;;;;;;;OAOG;IACH,iCAAgB,GAAhB,UAAiB,SAAiB,EAAE,OAAqC;QAAzE,iBAsBC;QArBG,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YAC/B,OAAO,CAAC,IAAI,CAAC,wCAAwC,GAAG,SAAS,GAAG,aAAa,GAAG,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC1G,KAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CACpC,wBAAwB,EACxB,EAAE,QAAQ,EAAE,KAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,WAAA,EAAE,EAC7C,UAAC,KAAK,EAAE,QAAQ;gBACZ,IAAI,KAAK,EAAE;oBACP,OAAO,CAAC,KAAK,CAAC,8CAA8C,GAAG,SAAS,GAAG,aAAa,GAAG,KAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;oBACxH,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE;wBACpB,MAAM,CAAC,IAAI,6BAAa,CAAC,iCAAiB,CAAC,0BAA0B,EAAE,2DAA2D,CAAC,CAAC,CAAC;qBACxI;yBAAM;wBACH,MAAM,CAAC,KAAK,CAAC,CAAC;qBACjB;iBACJ;qBAAM;oBACH,KAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;oBACnC,OAAO,CAAC,IAAI,CAAC,iCAAiC,GAAG,SAAS,GAAG,kCAAkC,GAAG,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;oBACxH,OAAO,EAAE,CAAC;iBACb;YACL,CAAC,CACJ,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;IAGD;;;;;;OAMG;IACH,oCAAmB,GAAnB,UAAoB,SAAiB;QAArC,iBAsBC;QArBG,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YAC/B,OAAO,CAAC,IAAI,CAAC,0CAA0C,GAAG,SAAS,GAAG,aAAa,GAAG,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC5G,KAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CACpC,2BAA2B,EAC3B,EAAE,QAAQ,EAAE,KAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,WAAA,EAAE,EAC7C,UAAC,KAAK,EAAE,QAAQ;gBACZ,IAAI,KAAK,EAAE;oBACP,OAAO,CAAC,KAAK,CAAC,gDAAgD,GAAG,SAAS,GAAG,aAAa,GAAG,KAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;oBAC1H,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE;wBACpB,MAAM,CAAC,IAAI,6BAAa,CAAC,iCAAiB,CAAC,0BAA0B,EAAE,2DAA2D,CAAC,CAAC,CAAC;qBACxI;yBAAM;wBACH,MAAM,CAAC,KAAK,CAAC,CAAC;qBACjB;iBACJ;qBAAM;oBACH,OAAO,KAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;oBAChC,OAAO,CAAC,IAAI,CAAC,iCAAiC,GAAG,SAAS,GAAG,kCAAkC,GAAG,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;oBACxH,OAAO,EAAE,CAAC;iBACb;YACL,CAAC,CACJ,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;IAEL,aAAC;AAAD,CAAC,AAjKD,IAiKC;AAjKY,wBAAM"}

View File

@ -1,83 +0,0 @@
import { Stream } from './Stream';
import { LocalRecorderState } from '../OpenViduInternal/Enums/LocalRecorderState';
/**
* Easy recording of [[Stream]] objects straightaway from the browser. Initialized with [[OpenVidu.initLocalRecorder]] method
*
* > WARNINGS:
* - Performing browser local recording of **remote streams** may cause some troubles. A long waiting time may be required after calling _LocalRecorder.stop()_ in this case
* - Only Chrome and Firefox support local stream recording
*/
export declare class LocalRecorder {
private stream;
state: LocalRecorderState;
private connectionId;
private mediaRecorder;
private chunks;
private blob;
private id;
private videoPreviewSrc;
private videoPreview;
/**
* @hidden
*/
constructor(stream: Stream);
/**
* Starts the recording of the Stream. [[state]] property must be `READY`. After method succeeds is set to `RECORDING`
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the recording successfully started and rejected with an Error object if not
*/
record(): Promise<any>;
/**
* Ends the recording of the Stream. [[state]] property must be `RECORDING` or `PAUSED`. After method succeeds is set to `FINISHED`
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the recording successfully stopped and rejected with an Error object if not
*/
stop(): Promise<any>;
/**
* Pauses the recording of the Stream. [[state]] property must be `RECORDING`. After method succeeds is set to `PAUSED`
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the recording was successfully paused and rejected with an Error object if not
*/
pause(): Promise<any>;
/**
* Resumes the recording of the Stream. [[state]] property must be `PAUSED`. After method succeeds is set to `RECORDING`
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the recording was successfully resumed and rejected with an Error object if not
*/
resume(): Promise<any>;
/**
* Previews the recording, appending a new HTMLVideoElement to element with id `parentId`. [[state]] property must be `FINISHED`
*/
preview(parentElement: any): HTMLVideoElement;
/**
* Gracefully stops and cleans the current recording (WARNING: it is completely dismissed). Sets [[state]] to `READY` so the recording can start again
*/
clean(): void;
/**
* Downloads the recorded video through the browser. [[state]] property must be `FINISHED`
*/
download(): void;
/**
* Gets the raw Blob file. Methods preview, download, uploadAsBinary and uploadAsMultipartfile use this same file to perform their specific actions. [[state]] property must be `FINISHED`
*/
getBlob(): Blob;
/**
* Uploads the recorded video as a binary file performing an HTTP/POST operation to URL `endpoint`. [[state]] property must be `FINISHED`. Optional HTTP headers can be passed as second parameter. For example:
* ```
* var headers = {
* "Cookie": "$Version=1; Skin=new;",
* "Authorization":"Basic QWxhZGpbjpuIHNlctZQ=="
* }
* ```
* @returns A Promise (to which you can optionally subscribe to) that is resolved with the `http.responseText` from server if the operation was successful and rejected with the failed `http.status` if not
*/
uploadAsBinary(endpoint: string, headers?: any): Promise<any>;
/**
* Uploads the recorded video as a multipart file performing an HTTP/POST operation to URL `endpoint`. [[state]] property must be `FINISHED`. Optional HTTP headers can be passed as second parameter. For example:
* ```
* var headers = {
* "Cookie": "$Version=1; Skin=new;",
* "Authorization":"Basic QWxhZGpbjpuIHNlctZQ=="
* }
* ```
* @returns A Promise (to which you can optionally subscribe to) that is resolved with the `http.responseText` from server if the operation was successful and rejected with the failed `http.status` if not:
*/
uploadAsMultipartfile(endpoint: string, headers?: any): Promise<any>;
private onStopDefault;
}

View File

@ -1,329 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
var LocalRecorderState_1 = require("../OpenViduInternal/Enums/LocalRecorderState");
var platform = require("platform");
/**
* Easy recording of [[Stream]] objects straightaway from the browser. Initialized with [[OpenVidu.initLocalRecorder]] method
*
* > WARNINGS:
* - Performing browser local recording of **remote streams** may cause some troubles. A long waiting time may be required after calling _LocalRecorder.stop()_ in this case
* - Only Chrome and Firefox support local stream recording
*/
var LocalRecorder = /** @class */ (function () {
/**
* @hidden
*/
function LocalRecorder(stream) {
this.stream = stream;
this.chunks = [];
this.connectionId = (!!this.stream.connection) ? this.stream.connection.connectionId : 'default-connection';
this.id = this.stream.streamId + '_' + this.connectionId + '_localrecord';
this.state = LocalRecorderState_1.LocalRecorderState.READY;
}
/**
* Starts the recording of the Stream. [[state]] property must be `READY`. After method succeeds is set to `RECORDING`
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the recording successfully started and rejected with an Error object if not
*/
LocalRecorder.prototype.record = function () {
var _this = this;
return new Promise(function (resolve, reject) {
try {
if (typeof MediaRecorder === 'undefined') {
console.error('MediaRecorder not supported on your browser. See compatibility in https://caniuse.com/#search=MediaRecorder');
throw (Error('MediaRecorder not supported on your browser. See compatibility in https://caniuse.com/#search=MediaRecorder'));
}
if (_this.state !== LocalRecorderState_1.LocalRecorderState.READY) {
throw (Error('\'LocalRecord.record()\' needs \'LocalRecord.state\' to be \'READY\' (current value: \'' + _this.state + '\'). Call \'LocalRecorder.clean()\' or init a new LocalRecorder before'));
}
console.log("Starting local recording of stream '" + _this.stream.streamId + "' of connection '" + _this.connectionId + "'");
if (typeof MediaRecorder.isTypeSupported === 'function') {
var options = void 0;
if (MediaRecorder.isTypeSupported('video/webm;codecs=vp9')) {
options = { mimeType: 'video/webm;codecs=vp9' };
}
else if (MediaRecorder.isTypeSupported('video/webm;codecs=h264')) {
options = { mimeType: 'video/webm;codecs=h264' };
}
else if (MediaRecorder.isTypeSupported('video/webm;codecs=vp8')) {
options = { mimeType: 'video/webm;codecs=vp8' };
}
console.log('Using mimeType ' + options.mimeType);
_this.mediaRecorder = new MediaRecorder(_this.stream.getMediaStream(), options);
}
else {
console.warn('isTypeSupported is not supported, using default codecs for browser');
_this.mediaRecorder = new MediaRecorder(_this.stream.getMediaStream());
}
_this.mediaRecorder.start(10);
}
catch (err) {
reject(err);
}
_this.mediaRecorder.ondataavailable = function (e) {
_this.chunks.push(e.data);
};
_this.mediaRecorder.onerror = function (e) {
console.error('MediaRecorder error: ', e);
};
_this.mediaRecorder.onstart = function () {
console.log('MediaRecorder started (state=' + _this.mediaRecorder.state + ')');
};
_this.mediaRecorder.onstop = function () {
_this.onStopDefault();
};
_this.mediaRecorder.onpause = function () {
console.log('MediaRecorder paused (state=' + _this.mediaRecorder.state + ')');
};
_this.mediaRecorder.onresume = function () {
console.log('MediaRecorder resumed (state=' + _this.mediaRecorder.state + ')');
};
_this.mediaRecorder.onwarning = function (e) {
console.log('MediaRecorder warning: ' + e);
};
_this.state = LocalRecorderState_1.LocalRecorderState.RECORDING;
resolve();
});
};
/**
* Ends the recording of the Stream. [[state]] property must be `RECORDING` or `PAUSED`. After method succeeds is set to `FINISHED`
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the recording successfully stopped and rejected with an Error object if not
*/
LocalRecorder.prototype.stop = function () {
var _this = this;
return new Promise(function (resolve, reject) {
try {
if (_this.state === LocalRecorderState_1.LocalRecorderState.READY || _this.state === LocalRecorderState_1.LocalRecorderState.FINISHED) {
throw (Error('\'LocalRecord.stop()\' needs \'LocalRecord.state\' to be \'RECORDING\' or \'PAUSED\' (current value: \'' + _this.state + '\'). Call \'LocalRecorder.start()\' before'));
}
_this.mediaRecorder.onstop = function () {
_this.onStopDefault();
resolve();
};
_this.mediaRecorder.stop();
}
catch (e) {
reject(e);
}
});
};
/**
* Pauses the recording of the Stream. [[state]] property must be `RECORDING`. After method succeeds is set to `PAUSED`
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the recording was successfully paused and rejected with an Error object if not
*/
LocalRecorder.prototype.pause = function () {
var _this = this;
return new Promise(function (resolve, reject) {
try {
if (_this.state !== LocalRecorderState_1.LocalRecorderState.RECORDING) {
reject(Error('\'LocalRecord.pause()\' needs \'LocalRecord.state\' to be \'RECORDING\' (current value: \'' + _this.state + '\'). Call \'LocalRecorder.start()\' or \'LocalRecorder.resume()\' before'));
}
_this.mediaRecorder.pause();
_this.state = LocalRecorderState_1.LocalRecorderState.PAUSED;
}
catch (error) {
reject(error);
}
});
};
/**
* Resumes the recording of the Stream. [[state]] property must be `PAUSED`. After method succeeds is set to `RECORDING`
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the recording was successfully resumed and rejected with an Error object if not
*/
LocalRecorder.prototype.resume = function () {
var _this = this;
return new Promise(function (resolve, reject) {
try {
if (_this.state !== LocalRecorderState_1.LocalRecorderState.PAUSED) {
throw (Error('\'LocalRecord.resume()\' needs \'LocalRecord.state\' to be \'PAUSED\' (current value: \'' + _this.state + '\'). Call \'LocalRecorder.pause()\' before'));
}
_this.mediaRecorder.resume();
_this.state = LocalRecorderState_1.LocalRecorderState.RECORDING;
}
catch (error) {
reject(error);
}
});
};
/**
* Previews the recording, appending a new HTMLVideoElement to element with id `parentId`. [[state]] property must be `FINISHED`
*/
LocalRecorder.prototype.preview = function (parentElement) {
if (this.state !== LocalRecorderState_1.LocalRecorderState.FINISHED) {
throw (Error('\'LocalRecord.preview()\' needs \'LocalRecord.state\' to be \'FINISHED\' (current value: \'' + this.state + '\'). Call \'LocalRecorder.stop()\' before'));
}
this.videoPreview = document.createElement('video');
this.videoPreview.id = this.id;
this.videoPreview.autoplay = true;
if (platform.name === 'Safari') {
this.videoPreview.setAttribute('playsinline', 'true');
}
if (typeof parentElement === 'string') {
var parentElementDom = document.getElementById(parentElement);
if (parentElementDom) {
this.videoPreview = parentElementDom.appendChild(this.videoPreview);
}
}
else {
this.videoPreview = parentElement.appendChild(this.videoPreview);
}
this.videoPreview.src = this.videoPreviewSrc;
return this.videoPreview;
};
/**
* Gracefully stops and cleans the current recording (WARNING: it is completely dismissed). Sets [[state]] to `READY` so the recording can start again
*/
LocalRecorder.prototype.clean = function () {
var _this = this;
var f = function () {
delete _this.blob;
_this.chunks = [];
delete _this.mediaRecorder;
_this.state = LocalRecorderState_1.LocalRecorderState.READY;
};
if (this.state === LocalRecorderState_1.LocalRecorderState.RECORDING || this.state === LocalRecorderState_1.LocalRecorderState.PAUSED) {
this.stop().then(function () { return f(); })["catch"](function () { return f(); });
}
else {
f();
}
};
/**
* Downloads the recorded video through the browser. [[state]] property must be `FINISHED`
*/
LocalRecorder.prototype.download = function () {
if (this.state !== LocalRecorderState_1.LocalRecorderState.FINISHED) {
throw (Error('\'LocalRecord.download()\' needs \'LocalRecord.state\' to be \'FINISHED\' (current value: \'' + this.state + '\'). Call \'LocalRecorder.stop()\' before'));
}
else {
var a = document.createElement('a');
a.style.display = 'none';
document.body.appendChild(a);
var url = window.URL.createObjectURL(this.blob);
a.href = url;
a.download = this.id + '.webm';
a.click();
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
}
};
/**
* Gets the raw Blob file. Methods preview, download, uploadAsBinary and uploadAsMultipartfile use this same file to perform their specific actions. [[state]] property must be `FINISHED`
*/
LocalRecorder.prototype.getBlob = function () {
if (this.state !== LocalRecorderState_1.LocalRecorderState.FINISHED) {
throw (Error('Call \'LocalRecord.stop()\' before getting Blob file'));
}
else {
return this.blob;
}
};
/**
* Uploads the recorded video as a binary file performing an HTTP/POST operation to URL `endpoint`. [[state]] property must be `FINISHED`. Optional HTTP headers can be passed as second parameter. For example:
* ```
* var headers = {
* "Cookie": "$Version=1; Skin=new;",
* "Authorization":"Basic QWxhZGpbjpuIHNlctZQ=="
* }
* ```
* @returns A Promise (to which you can optionally subscribe to) that is resolved with the `http.responseText` from server if the operation was successful and rejected with the failed `http.status` if not
*/
LocalRecorder.prototype.uploadAsBinary = function (endpoint, headers) {
var _this = this;
return new Promise(function (resolve, reject) {
if (_this.state !== LocalRecorderState_1.LocalRecorderState.FINISHED) {
reject(Error('\'LocalRecord.uploadAsBinary()\' needs \'LocalRecord.state\' to be \'FINISHED\' (current value: \'' + _this.state + '\'). Call \'LocalRecorder.stop()\' before'));
}
else {
var http_1 = new XMLHttpRequest();
http_1.open('POST', endpoint, true);
if (typeof headers === 'object') {
for (var _i = 0, _a = Object.keys(headers); _i < _a.length; _i++) {
var key = _a[_i];
http_1.setRequestHeader(key, headers[key]);
}
}
http_1.onreadystatechange = function () {
if (http_1.readyState === 4) {
if (http_1.status.toString().charAt(0) === '2') {
// Success response from server (HTTP status standard: 2XX is success)
resolve(http_1.responseText);
}
else {
reject(http_1.status);
}
}
};
http_1.send(_this.blob);
}
});
};
/**
* Uploads the recorded video as a multipart file performing an HTTP/POST operation to URL `endpoint`. [[state]] property must be `FINISHED`. Optional HTTP headers can be passed as second parameter. For example:
* ```
* var headers = {
* "Cookie": "$Version=1; Skin=new;",
* "Authorization":"Basic QWxhZGpbjpuIHNlctZQ=="
* }
* ```
* @returns A Promise (to which you can optionally subscribe to) that is resolved with the `http.responseText` from server if the operation was successful and rejected with the failed `http.status` if not:
*/
LocalRecorder.prototype.uploadAsMultipartfile = function (endpoint, headers) {
var _this = this;
return new Promise(function (resolve, reject) {
if (_this.state !== LocalRecorderState_1.LocalRecorderState.FINISHED) {
reject(Error('\'LocalRecord.uploadAsMultipartfile()\' needs \'LocalRecord.state\' to be \'FINISHED\' (current value: \'' + _this.state + '\'). Call \'LocalRecorder.stop()\' before'));
}
else {
var http_2 = new XMLHttpRequest();
http_2.open('POST', endpoint, true);
if (typeof headers === 'object') {
for (var _i = 0, _a = Object.keys(headers); _i < _a.length; _i++) {
var key = _a[_i];
http_2.setRequestHeader(key, headers[key]);
}
}
var sendable = new FormData();
sendable.append('file', _this.blob, _this.id + '.webm');
http_2.onreadystatechange = function () {
if (http_2.readyState === 4) {
if (http_2.status.toString().charAt(0) === '2') {
// Success response from server (HTTP status standard: 2XX is success)
resolve(http_2.responseText);
}
else {
reject(http_2.status);
}
}
};
http_2.send(sendable);
}
});
};
/* Private methods */
LocalRecorder.prototype.onStopDefault = function () {
console.log('MediaRecorder stopped (state=' + this.mediaRecorder.state + ')');
this.blob = new Blob(this.chunks, { type: 'video/webm' });
this.chunks = [];
this.videoPreviewSrc = window.URL.createObjectURL(this.blob);
this.state = LocalRecorderState_1.LocalRecorderState.FINISHED;
};
return LocalRecorder;
}());
exports.LocalRecorder = LocalRecorder;
//# sourceMappingURL=LocalRecorder.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,172 +0,0 @@
import { LocalRecorder } from './LocalRecorder';
import { Publisher } from './Publisher';
import { Session } from './Session';
import { Stream } from './Stream';
import { Device } from '../OpenViduInternal/Interfaces/Public/Device';
import { OpenViduAdvancedConfiguration } from '../OpenViduInternal/Interfaces/Public/OpenViduAdvancedConfiguration';
import { PublisherProperties } from '../OpenViduInternal/Interfaces/Public/PublisherProperties';
/**
* Entrypoint of OpenVidu Browser library.
* Use it to initialize objects of type [[Session]], [[Publisher]] and [[LocalRecorder]]
*/
export declare class OpenVidu {
private jsonRpcClient;
/**
* @hidden
*/
session: Session;
/**
* @hidden
*/
publishers: Publisher[];
/**
* @hidden
*/
wsUri: string;
/**
* @hidden
*/
secret: string;
/**
* @hidden
*/
recorder: boolean;
/**
* @hidden
*/
iceServers: RTCIceServer[];
/**
* @hidden
*/
role: string;
/**
* @hidden
*/
advancedConfiguration: OpenViduAdvancedConfiguration;
constructor();
/**
* Returns new session
*/
initSession(): Session;
initPublisher(targetElement: string | HTMLElement): Publisher;
initPublisher(targetElement: string | HTMLElement, properties: PublisherProperties): Publisher;
initPublisher(targetElement: string | HTMLElement, completionHandler: (error: Error | undefined) => void): Publisher;
initPublisher(targetElement: string | HTMLElement, properties: PublisherProperties, completionHandler: (error: Error | undefined) => void): Publisher;
/**
* Promisified version of [[OpenVidu.initPublisher]]
*
* > WARNING: events `accessDialogOpened` and `accessDialogClosed` will not be dispatched if using this method instead of [[OpenVidu.initPublisher]]
*/
initPublisherAsync(targetElement: string | HTMLElement): Promise<Publisher>;
initPublisherAsync(targetElement: string | HTMLElement, properties: PublisherProperties): Promise<Publisher>;
/**
* Returns a new local recorder for recording streams straight away from the browser
* @param stream Stream to record
*/
initLocalRecorder(stream: Stream): LocalRecorder;
/**
* Checks if the browser supports OpenVidu
* @returns 1 if the browser supports OpenVidu, 0 otherwise
*/
checkSystemRequirements(): number;
/**
* Checks if the browser supports screen-sharing. Desktop Chrome, Firefox and Opera support screen-sharing
* @returns 1 if the browser supports screen-sharing, 0 otherwise
*/
checkScreenSharingCapabilities(): number;
/**
* Collects information about the media input devices available on the system. You can pass property `deviceId` of a [[Device]] object as value of `audioSource` or `videoSource` properties in [[initPublisher]] method
*/
getDevices(): Promise<Device[]>;
/**
* Get a MediaStream object that you can customize before calling [[initPublisher]] (pass _MediaStreamTrack_ property of the _MediaStream_ value resolved by the Promise as `audioSource` or `videoSource` properties in [[initPublisher]])
*
* Parameter `options` is the same as in [[initPublisher]] second parameter (of type [[PublisherProperties]]), but only the following properties will be applied: `audioSource`, `videoSource`, `frameRate`, `resolution`
*
* To customize the Publisher's video, the API for HTMLCanvasElement is very useful. For example, to get a black-and-white video at 10 fps and HD resolution with no sound:
* ```
* var OV = new OpenVidu();
* var FRAME_RATE = 10;
*
* OV.getUserMedia({
* audioSource: false;
* videoSource: undefined,
* resolution: '1280x720',
* frameRate: FRAME_RATE
* })
* .then(mediaStream => {
*
* var videoTrack = mediaStream.getVideoTracks()[0];
* var video = document.createElement('video');
* video.srcObject = new MediaStream([videoTrack]);
*
* var canvas = document.createElement('canvas');
* var ctx = canvas.getContext('2d');
* ctx.filter = 'grayscale(100%)';
*
* video.addEventListener('play', () => {
* var loop = () => {
* if (!video.paused && !video.ended) {
* ctx.drawImage(video, 0, 0, 300, 170);
* setTimeout(loop, 1000/ FRAME_RATE); // Drawing at 10 fps
* }
* };
* loop();
* });
* video.play();
*
* var grayVideoTrack = canvas.captureStream(FRAME_RATE).getVideoTracks()[0];
* var publisher = this.OV.initPublisher(
* myHtmlTarget,
* {
* audioSource: false,
* videoSource: grayVideoTrack
* });
* });
* ```
*/
getUserMedia(options: PublisherProperties): Promise<MediaStream>;
/**
* Disable all logging except error level
*/
enableProdMode(): void;
/**
* Set OpenVidu advanced configuration options. Currently `configuration` is an object with the following optional properties (see [[OpenViduAdvancedConfiguration]] for more details):
* - `iceServers`: set custom STUN/TURN servers to be used by OpenVidu Browser
* - `screenShareChromeExtension`: url to a custom screen share extension for Chrome to be used instead of the default one, based on ours [https://github.com/OpenVidu/openvidu-screen-sharing-chrome-extension](https://github.com/OpenVidu/openvidu-screen-sharing-chrome-extension)
* - `publisherSpeakingEventsOptions`: custom configuration for the [[PublisherSpeakingEvent]] feature
*/
setAdvancedConfiguration(configuration: OpenViduAdvancedConfiguration): void;
/**
* @hidden
*/
generateMediaConstraints(publisherProperties: PublisherProperties): Promise<MediaStreamConstraints>;
/**
* @hidden
*/
startWs(onConnectSucces: (error: Error) => void): void;
/**
* @hidden
*/
closeWs(): void;
/**
* @hidden
*/
sendRequest(method: string, params: any, callback?: any): void;
/**
* @hidden
*/
getWsUri(): string;
/**
* @hidden
*/
getSecret(): string;
/**
* @hidden
*/
getRecorder(): boolean;
private disconnectCallback;
private reconnectingCallback;
private reconnectedCallback;
private isRoomAvailable;
}

View File

@ -1,623 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
var LocalRecorder_1 = require("./LocalRecorder");
var Publisher_1 = require("./Publisher");
var Session_1 = require("./Session");
var StreamPropertyChangedEvent_1 = require("../OpenViduInternal/Events/StreamPropertyChangedEvent");
var OpenViduError_1 = require("../OpenViduInternal/Enums/OpenViduError");
var VideoInsertMode_1 = require("../OpenViduInternal/Enums/VideoInsertMode");
var screenSharingAuto = require("../OpenViduInternal/ScreenSharing/Screen-Capturing-Auto");
var screenSharing = require("../OpenViduInternal/ScreenSharing/Screen-Capturing");
var RpcBuilder = require("../OpenViduInternal/KurentoUtils/kurento-jsonrpc");
var platform = require("platform");
platform['isIonicIos'] = (platform.product === 'iPhone' || platform.product === 'iPad') && platform.ua.indexOf('Safari') === -1;
/**
* Entrypoint of OpenVidu Browser library.
* Use it to initialize objects of type [[Session]], [[Publisher]] and [[LocalRecorder]]
*/
var OpenVidu = /** @class */ (function () {
function OpenVidu() {
var _this = this;
/**
* @hidden
*/
this.publishers = [];
/**
* @hidden
*/
this.secret = '';
/**
* @hidden
*/
this.recorder = false;
/**
* @hidden
*/
this.advancedConfiguration = {};
console.info("'OpenVidu' initialized");
if (platform.os.family === 'iOS' || platform.os.family === 'Android') {
// Listen to orientationchange only on mobile devices
window.addEventListener('orientationchange', function () {
_this.publishers.forEach(function (publisher) {
if (!!publisher.stream && !!publisher.stream.hasVideo && !!publisher.stream.streamManager.videos[0]) {
var attempts_1 = 0;
var oldWidth_1 = publisher.stream.videoDimensions.width;
var oldHeight_1 = publisher.stream.videoDimensions.height;
var getNewVideoDimensions_1 = function () {
return new Promise(function (resolve, reject) {
if (platform['isIonicIos']) {
// iOS Ionic. Limitation: must get new dimensions from an existing video element already inserted into DOM
resolve({
newWidth: publisher.stream.streamManager.videos[0].video.videoWidth,
newHeight: publisher.stream.streamManager.videos[0].video.videoHeight
});
}
else {
// Rest of platforms
// New resolution got from different places for Chrome and Firefox. Chrome needs a videoWidth and videoHeight of a videoElement.
// Firefox needs getSettings from the videoTrack
var firefoxSettings = publisher.stream.getMediaStream().getVideoTracks()[0].getSettings();
var newWidth = ((platform.name.toLowerCase().indexOf('firefox') !== -1) ? firefoxSettings.width : publisher.videoReference.videoWidth);
var newHeight = ((platform.name.toLowerCase().indexOf('firefox') !== -1) ? firefoxSettings.height : publisher.videoReference.videoHeight);
resolve({ newWidth: newWidth, newHeight: newHeight });
}
});
};
var repeatUntilChange_1 = setInterval(function () {
getNewVideoDimensions_1().then(function (newDimensions) {
sendStreamPropertyChangedEvent_1(oldWidth_1, oldHeight_1, newDimensions.newWidth, newDimensions.newHeight);
});
}, 75);
var sendStreamPropertyChangedEvent_1 = function (oldWidth, oldHeight, newWidth, newHeight) {
attempts_1++;
if (attempts_1 > 10) {
clearTimeout(repeatUntilChange_1);
}
if (newWidth !== oldWidth || newHeight !== oldHeight) {
publisher.stream.videoDimensions = {
width: newWidth || 0,
height: newHeight || 0
};
_this.sendRequest('streamPropertyChanged', {
streamId: publisher.stream.streamId,
property: 'videoDimensions',
newValue: JSON.stringify(publisher.stream.videoDimensions),
reason: 'deviceRotated'
}, function (error, response) {
if (error) {
console.error("Error sending 'streamPropertyChanged' event", error);
}
else {
_this.session.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent_1.StreamPropertyChangedEvent(_this.session, publisher.stream, 'videoDimensions', publisher.stream.videoDimensions, { width: oldWidth, height: oldHeight }, 'deviceRotated')]);
publisher.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent_1.StreamPropertyChangedEvent(publisher, publisher.stream, 'videoDimensions', publisher.stream.videoDimensions, { width: oldWidth, height: oldHeight }, 'deviceRotated')]);
}
});
clearTimeout(repeatUntilChange_1);
}
};
}
});
});
}
}
/**
* Returns new session
*/
OpenVidu.prototype.initSession = function () {
this.session = new Session_1.Session(this);
return this.session;
};
/**
* Returns a new publisher
*
* #### Events dispatched
*
* The [[Publisher]] object will dispatch an `accessDialogOpened` event, only if the pop-up shown by the browser to request permissions for the camera is opened. You can use this event to alert the user about granting permissions
* for your website. An `accessDialogClosed` event will also be dispatched after user clicks on "Allow" or "Block" in the pop-up.
*
* The [[Publisher]] object will dispatch an `accessAllowed` or `accessDenied` event once it has been granted access to the requested input devices or not.
*
* The [[Publisher]] object will dispatch a `videoElementCreated` event once a HTML video element has been added to DOM (only if you
* [let OpenVidu take care of the video players](/docs/how-do-i/manage-videos/#let-openvidu-take-care-of-the-video-players)). See [[VideoElementEvent]] to learn more.
*
* The [[Publisher]] object will dispatch a `streamPlaying` event once the local streams starts playing. See [[StreamManagerEvent]] to learn more.
*
* @param targetElement HTML DOM element (or its `id` attribute) in which the video element of the Publisher will be inserted (see [[PublisherProperties.insertMode]]). If *null* or *undefined* no default video will be created for this Publisher.
* You can always call method [[Publisher.addVideoElement]] or [[Publisher.createVideoElement]] to manage the video elements on your own (see [Manage video players](/docs/how-do-i/manage-videos) section)
* @param completionHandler `error` parameter is null if `initPublisher` succeeds, and is defined if it fails.
* `completionHandler` function is called before the Publisher dispatches an `accessAllowed` or an `accessDenied` event
*/
OpenVidu.prototype.initPublisher = function (targetElement, param2, param3) {
var properties;
if (!!param2 && (typeof param2 !== 'function')) {
// Matches 'initPublisher(targetElement, properties)' or 'initPublisher(targetElement, properties, completionHandler)'
properties = param2;
properties = {
audioSource: (typeof properties.audioSource !== 'undefined') ? properties.audioSource : undefined,
frameRate: (properties.videoSource instanceof MediaStreamTrack) ? undefined : ((typeof properties.frameRate !== 'undefined') ? properties.frameRate : undefined),
insertMode: (typeof properties.insertMode !== 'undefined') ? ((typeof properties.insertMode === 'string') ? VideoInsertMode_1.VideoInsertMode[properties.insertMode] : properties.insertMode) : VideoInsertMode_1.VideoInsertMode.APPEND,
mirror: (typeof properties.mirror !== 'undefined') ? properties.mirror : true,
publishAudio: (typeof properties.publishAudio !== 'undefined') ? properties.publishAudio : true,
publishVideo: (typeof properties.publishVideo !== 'undefined') ? properties.publishVideo : true,
resolution: (properties.videoSource instanceof MediaStreamTrack) ? undefined : ((typeof properties.resolution !== 'undefined') ? properties.resolution : '640x480'),
videoSource: (typeof properties.videoSource !== 'undefined') ? properties.videoSource : undefined,
filter: properties.filter
};
}
else {
// Matches 'initPublisher(targetElement)' or 'initPublisher(targetElement, completionHandler)'
properties = {
insertMode: VideoInsertMode_1.VideoInsertMode.APPEND,
mirror: true,
publishAudio: true,
publishVideo: true,
resolution: '640x480'
};
}
var publisher = new Publisher_1.Publisher(targetElement, properties, this);
var completionHandler;
if (!!param2 && (typeof param2 === 'function')) {
completionHandler = param2;
}
else if (!!param3) {
completionHandler = param3;
}
publisher.initialize()
.then(function () {
if (completionHandler !== undefined) {
completionHandler(undefined);
}
publisher.emitEvent('accessAllowed', []);
})["catch"](function (error) {
if (completionHandler !== undefined) {
completionHandler(error);
}
publisher.emitEvent('accessDenied', []);
});
this.publishers.push(publisher);
return publisher;
};
OpenVidu.prototype.initPublisherAsync = function (targetElement, properties) {
var _this = this;
return new Promise(function (resolve, reject) {
var publisher;
var callback = function (error) {
if (!!error) {
reject(error);
}
else {
resolve(publisher);
}
};
if (!!properties) {
publisher = _this.initPublisher(targetElement, properties, callback);
}
else {
publisher = _this.initPublisher(targetElement, callback);
}
});
};
/**
* Returns a new local recorder for recording streams straight away from the browser
* @param stream Stream to record
*/
OpenVidu.prototype.initLocalRecorder = function (stream) {
return new LocalRecorder_1.LocalRecorder(stream);
};
/**
* Checks if the browser supports OpenVidu
* @returns 1 if the browser supports OpenVidu, 0 otherwise
*/
OpenVidu.prototype.checkSystemRequirements = function () {
var browser = platform.name;
var family = platform.os.family;
var userAgent = !!platform.ua ? platform.ua : navigator.userAgent;
// Reject iPhones and iPads if not Safari ('Safari' also covers Ionic for iOS)
if (family === 'iOS' && (browser !== 'Safari' || userAgent.indexOf('CriOS') !== -1 || userAgent.indexOf('FxiOS') !== -1)) {
return 0;
}
// Accept: Chrome (desktop and Android), Firefox (desktop and Android), Opera (desktop and Android),
// Safari (OSX and iOS), Ionic (Android and iOS)
if ((browser !== 'Safari') &&
(browser !== 'Chrome') && (browser !== 'Chrome Mobile') &&
(browser !== 'Firefox') && (browser !== 'Firefox Mobile') &&
(browser !== 'Opera') && (browser !== 'Opera Mobile') &&
(browser !== 'Android Browser')) {
return 0;
}
else {
return 1;
}
};
/**
* Checks if the browser supports screen-sharing. Desktop Chrome, Firefox and Opera support screen-sharing
* @returns 1 if the browser supports screen-sharing, 0 otherwise
*/
OpenVidu.prototype.checkScreenSharingCapabilities = function () {
var browser = platform.name;
var family = platform.os.family;
// Reject mobile devices
if (family === 'iOS' || family === 'Android') {
return 0;
}
if ((browser !== 'Chrome') && (browser !== 'Firefox') && (browser !== 'Opera')) {
return 0;
}
else {
return 1;
}
};
/**
* Collects information about the media input devices available on the system. You can pass property `deviceId` of a [[Device]] object as value of `audioSource` or `videoSource` properties in [[initPublisher]] method
*/
OpenVidu.prototype.getDevices = function () {
return new Promise(function (resolve, reject) {
navigator.mediaDevices.enumerateDevices().then(function (deviceInfos) {
var devices = [];
deviceInfos.forEach(function (deviceInfo) {
if (deviceInfo.kind === 'audioinput' || deviceInfo.kind === 'videoinput') {
devices.push({
kind: deviceInfo.kind,
deviceId: deviceInfo.deviceId,
label: deviceInfo.label
});
}
});
resolve(devices);
})["catch"](function (error) {
console.error('Error getting devices', error);
reject(error);
});
});
};
/**
* Get a MediaStream object that you can customize before calling [[initPublisher]] (pass _MediaStreamTrack_ property of the _MediaStream_ value resolved by the Promise as `audioSource` or `videoSource` properties in [[initPublisher]])
*
* Parameter `options` is the same as in [[initPublisher]] second parameter (of type [[PublisherProperties]]), but only the following properties will be applied: `audioSource`, `videoSource`, `frameRate`, `resolution`
*
* To customize the Publisher's video, the API for HTMLCanvasElement is very useful. For example, to get a black-and-white video at 10 fps and HD resolution with no sound:
* ```
* var OV = new OpenVidu();
* var FRAME_RATE = 10;
*
* OV.getUserMedia({
* audioSource: false;
* videoSource: undefined,
* resolution: '1280x720',
* frameRate: FRAME_RATE
* })
* .then(mediaStream => {
*
* var videoTrack = mediaStream.getVideoTracks()[0];
* var video = document.createElement('video');
* video.srcObject = new MediaStream([videoTrack]);
*
* var canvas = document.createElement('canvas');
* var ctx = canvas.getContext('2d');
* ctx.filter = 'grayscale(100%)';
*
* video.addEventListener('play', () => {
* var loop = () => {
* if (!video.paused && !video.ended) {
* ctx.drawImage(video, 0, 0, 300, 170);
* setTimeout(loop, 1000/ FRAME_RATE); // Drawing at 10 fps
* }
* };
* loop();
* });
* video.play();
*
* var grayVideoTrack = canvas.captureStream(FRAME_RATE).getVideoTracks()[0];
* var publisher = this.OV.initPublisher(
* myHtmlTarget,
* {
* audioSource: false,
* videoSource: grayVideoTrack
* });
* });
* ```
*/
OpenVidu.prototype.getUserMedia = function (options) {
var _this = this;
return new Promise(function (resolve, reject) {
_this.generateMediaConstraints(options)
.then(function (constraints) {
navigator.mediaDevices.getUserMedia(constraints)
.then(function (mediaStream) {
resolve(mediaStream);
})["catch"](function (error) {
var errorName;
var errorMessage = error.toString();
if (!(options.videoSource === 'screen')) {
errorName = OpenViduError_1.OpenViduErrorName.DEVICE_ACCESS_DENIED;
}
else {
errorName = OpenViduError_1.OpenViduErrorName.SCREEN_CAPTURE_DENIED;
}
reject(new OpenViduError_1.OpenViduError(errorName, errorMessage));
});
})["catch"](function (error) {
reject(error);
});
});
};
/* tslint:disable:no-empty */
/**
* Disable all logging except error level
*/
OpenVidu.prototype.enableProdMode = function () {
console.log = function () { };
console.debug = function () { };
console.info = function () { };
console.warn = function () { };
};
/* tslint:enable:no-empty */
/**
* Set OpenVidu advanced configuration options. Currently `configuration` is an object with the following optional properties (see [[OpenViduAdvancedConfiguration]] for more details):
* - `iceServers`: set custom STUN/TURN servers to be used by OpenVidu Browser
* - `screenShareChromeExtension`: url to a custom screen share extension for Chrome to be used instead of the default one, based on ours [https://github.com/OpenVidu/openvidu-screen-sharing-chrome-extension](https://github.com/OpenVidu/openvidu-screen-sharing-chrome-extension)
* - `publisherSpeakingEventsOptions`: custom configuration for the [[PublisherSpeakingEvent]] feature
*/
OpenVidu.prototype.setAdvancedConfiguration = function (configuration) {
this.advancedConfiguration = configuration;
};
/* Hidden methods */
/**
* @hidden
*/
OpenVidu.prototype.generateMediaConstraints = function (publisherProperties) {
var _this = this;
return new Promise(function (resolve, reject) {
var audio, video;
if (publisherProperties.audioSource === null || publisherProperties.audioSource === false) {
audio = false;
}
else if (publisherProperties.audioSource === undefined) {
audio = true;
}
else {
audio = publisherProperties.audioSource;
}
if (publisherProperties.videoSource === null || publisherProperties.videoSource === false) {
video = false;
}
else {
video = {
height: {
ideal: 480
},
width: {
ideal: 640
}
};
}
var mediaConstraints = {
audio: audio,
video: video
};
if (typeof mediaConstraints.audio === 'string') {
mediaConstraints.audio = { deviceId: { exact: mediaConstraints.audio } };
}
if (mediaConstraints.video) {
if (!!publisherProperties.resolution) {
var widthAndHeight = publisherProperties.resolution.toLowerCase().split('x');
var width = Number(widthAndHeight[0]);
var height = Number(widthAndHeight[1]);
mediaConstraints.video.width.ideal = width;
mediaConstraints.video.height.ideal = height;
}
if (!!publisherProperties.frameRate) {
mediaConstraints.video.frameRate = { ideal: publisherProperties.frameRate };
}
if (!!publisherProperties.videoSource && typeof publisherProperties.videoSource === 'string') {
if (publisherProperties.videoSource === 'screen' ||
(platform.name.indexOf('Firefox') !== -1 && publisherProperties.videoSource === 'window')) {
if (platform.name !== 'Chrome' && platform.name.indexOf('Firefox') === -1 && platform.name !== 'Opera') {
var error = new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.SCREEN_SHARING_NOT_SUPPORTED, 'You can only screen share in desktop Chrome, Firefox or Opera. Detected browser: ' + platform.name);
console.error(error);
reject(error);
}
else {
if (!!_this.advancedConfiguration.screenShareChromeExtension && !(platform.name.indexOf('Firefox') !== -1)) {
// Custom screen sharing extension for Chrome (and Opera)
screenSharing.getScreenConstraints(function (error, screenConstraints) {
if (!!error || !!screenConstraints.mandatory && screenConstraints.mandatory.chromeMediaSource === 'screen') {
if (error === 'permission-denied' || error === 'PermissionDeniedError') {
var error_1 = new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.SCREEN_CAPTURE_DENIED, 'You must allow access to one window of your desktop');
console.error(error_1);
reject(error_1);
}
else {
var extensionId = _this.advancedConfiguration.screenShareChromeExtension.split('/').pop().trim();
screenSharing.getChromeExtensionStatus(extensionId, function (status) {
if (status === 'installed-disabled') {
var error_2 = new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.SCREEN_EXTENSION_DISABLED, 'You must enable the screen extension');
console.error(error_2);
reject(error_2);
}
if (status === 'not-installed') {
var error_3 = new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.SCREEN_EXTENSION_NOT_INSTALLED, _this.advancedConfiguration.screenShareChromeExtension);
console.error(error_3);
reject(error_3);
}
});
}
}
else {
mediaConstraints.video = screenConstraints;
resolve(mediaConstraints);
}
});
}
else {
// Default screen sharing extension for Chrome (or is Firefox)
var firefoxString = platform.name.indexOf('Firefox') !== -1 ? publisherProperties.videoSource : undefined;
screenSharingAuto.getScreenId(firefoxString, function (error, sourceId, screenConstraints) {
if (!!error) {
if (error === 'not-installed') {
var extensionUrl = !!_this.advancedConfiguration.screenShareChromeExtension ? _this.advancedConfiguration.screenShareChromeExtension :
'https://chrome.google.com/webstore/detail/openvidu-screensharing/lfcgfepafnobdloecchnfaclibenjold';
var error_4 = new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.SCREEN_EXTENSION_NOT_INSTALLED, extensionUrl);
console.error(error_4);
reject(error_4);
}
else if (error === 'installed-disabled') {
var error_5 = new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.SCREEN_EXTENSION_DISABLED, 'You must enable the screen extension');
console.error(error_5);
reject(error_5);
}
else if (error === 'permission-denied') {
var error_6 = new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.SCREEN_CAPTURE_DENIED, 'You must allow access to one window of your desktop');
console.error(error_6);
reject(error_6);
}
}
else {
mediaConstraints.video = screenConstraints.video;
resolve(mediaConstraints);
}
});
}
publisherProperties.videoSource = 'screen';
}
}
else {
// tslint:disable-next-line:no-string-literal
mediaConstraints.video['deviceId'] = { exact: publisherProperties.videoSource };
resolve(mediaConstraints);
}
}
else {
resolve(mediaConstraints);
}
}
else {
resolve(mediaConstraints);
}
});
};
/**
* @hidden
*/
OpenVidu.prototype.startWs = function (onConnectSucces) {
var config = {
heartbeat: 5000,
sendCloseMessage: false,
ws: {
uri: this.wsUri,
useSockJS: false,
onconnected: onConnectSucces,
ondisconnect: this.disconnectCallback.bind(this),
onreconnecting: this.reconnectingCallback.bind(this),
onreconnected: this.reconnectedCallback.bind(this)
},
rpc: {
requestTimeout: 10000,
participantJoined: this.session.onParticipantJoined.bind(this.session),
participantPublished: this.session.onParticipantPublished.bind(this.session),
participantUnpublished: this.session.onParticipantUnpublished.bind(this.session),
participantLeft: this.session.onParticipantLeft.bind(this.session),
participantEvicted: this.session.onParticipantEvicted.bind(this.session),
recordingStarted: this.session.onRecordingStarted.bind(this.session),
recordingStopped: this.session.onRecordingStopped.bind(this.session),
sendMessage: this.session.onNewMessage.bind(this.session),
streamPropertyChanged: this.session.onStreamPropertyChanged.bind(this.session),
filterEventDispatched: this.session.onFilterEventDispatched.bind(this.session),
iceCandidate: this.session.recvIceCandidate.bind(this.session),
mediaError: this.session.onMediaError.bind(this.session)
}
};
this.jsonRpcClient = new RpcBuilder.clients.JsonRpcClient(config);
};
/**
* @hidden
*/
OpenVidu.prototype.closeWs = function () {
this.jsonRpcClient.close();
};
/**
* @hidden
*/
OpenVidu.prototype.sendRequest = function (method, params, callback) {
if (params && params instanceof Function) {
callback = params;
params = {};
}
console.debug('Sending request: {method:"' + method + '", params: ' + JSON.stringify(params) + '}');
this.jsonRpcClient.send(method, params, callback);
};
/**
* @hidden
*/
OpenVidu.prototype.getWsUri = function () {
return this.wsUri;
};
/**
* @hidden
*/
OpenVidu.prototype.getSecret = function () {
return this.secret;
};
/**
* @hidden
*/
OpenVidu.prototype.getRecorder = function () {
return this.recorder;
};
/* Private methods */
OpenVidu.prototype.disconnectCallback = function () {
console.warn('Websocket connection lost');
if (this.isRoomAvailable()) {
this.session.onLostConnection();
}
else {
alert('Connection error. Please reload page.');
}
};
OpenVidu.prototype.reconnectingCallback = function () {
console.warn('Websocket connection lost (reconnecting)');
if (this.isRoomAvailable()) {
this.session.onLostConnection();
}
else {
alert('Connection error. Please reload page.');
}
};
OpenVidu.prototype.reconnectedCallback = function () {
console.warn('Websocket reconnected');
if (this.isRoomAvailable()) {
this.session.onRecoveredConnection();
}
else {
alert('Connection error. Please reload page.');
}
};
OpenVidu.prototype.isRoomAvailable = function () {
if (this.session !== undefined && this.session instanceof Session_1.Session) {
return true;
}
else {
console.warn('Session instance not found');
return false;
}
};
return OpenVidu;
}());
exports.OpenVidu = OpenVidu;
//# sourceMappingURL=OpenVidu.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,101 +0,0 @@
/// <reference types="node" />
import { OpenVidu } from './OpenVidu';
import { Session } from './Session';
import { StreamManager } from './StreamManager';
import { EventDispatcher } from '../OpenViduInternal/Interfaces/Public/EventDispatcher';
import { PublisherProperties } from '../OpenViduInternal/Interfaces/Public/PublisherProperties';
import { Event } from '../OpenViduInternal/Events/Event';
/**
* Packs local media streams. Participants can publish it to a session. Initialized with [[OpenVidu.initPublisher]] method
*/
export declare class Publisher extends StreamManager {
/**
* Whether the Publisher has been granted access to the requested input devices or not
*/
accessAllowed: boolean;
/**
* Whether you have called [[Publisher.subscribeToRemote]] with value `true` or `false` (*false* by default)
*/
isSubscribedToRemote: boolean;
/**
* The [[Session]] to which the Publisher belongs
*/
session: Session;
private accessDenied;
private properties;
private permissionDialogTimeout;
/**
* @hidden
*/
openvidu: OpenVidu;
/**
* @hidden
*/
videoReference: HTMLVideoElement;
/**
* @hidden
*/
screenShareResizeInterval: NodeJS.Timer;
/**
* @hidden
*/
constructor(targEl: string | HTMLElement, properties: PublisherProperties, openvidu: OpenVidu);
/**
* Publish or unpublish the audio stream (if available). Calling this method twice in a row passing same value will have no effect
*
* #### Events dispatched
*
* > _Only if `Session.publish(Publisher)` has been called for this Publisher_
*
* The [[Session]] object of the local participant will dispatch a `streamPropertyChanged` event with `changedProperty` set to `"audioActive"` and `reason` set to `"publishAudio"`
* The [[Publisher]] object of the local participant will also dispatch the exact same event
*
* The [[Session]] object of every other participant connected to the session will dispatch a `streamPropertyChanged` event with `changedProperty` set to `"audioActive"` and `reason` set to `"publishAudio"`
* The respective [[Subscriber]] object of every other participant receiving this Publisher's stream will also dispatch the exact same event
*
* See [[StreamPropertyChangedEvent]] to learn more.
*
* @param value `true` to publish the audio stream, `false` to unpublish it
*/
publishAudio(value: boolean): void;
/**
* Publish or unpublish the video stream (if available). Calling this method twice in a row passing same value will have no effect
*
* #### Events dispatched
*
* > _Only if `Session.publish(Publisher)` has been called for this Publisher_
*
* The [[Session]] object of the local participant will dispatch a `streamPropertyChanged` event with `changedProperty` set to `"videoActive"` and `reason` set to `"publishVideo"`
* The [[Publisher]] object of the local participant will also dispatch the exact same event
*
* The [[Session]] object of every other participant connected to the session will dispatch a `streamPropertyChanged` event with `changedProperty` set to `"videoActive"` and `reason` set to `"publishVideo"`
* The respective [[Subscriber]] object of every other participant receiving this Publisher's stream will also dispatch the exact same event
*
* See [[StreamPropertyChangedEvent]] to learn more.
*
* @param value `true` to publish the video stream, `false` to unpublish it
*/
publishVideo(value: boolean): void;
/**
* Call this method before [[Session.publish]] if you prefer to subscribe to your Publisher's remote stream instead of using the local stream, as any other user would do.
*/
subscribeToRemote(value?: boolean): void;
/**
* See [[EventDispatcher.on]]
*/
on(type: string, handler: (event: Event) => void): EventDispatcher;
/**
* See [[EventDispatcher.once]]
*/
once(type: string, handler: (event: Event) => void): Publisher;
/**
* @hidden
*/
initialize(): Promise<any>;
/**
* @hidden
*/
reestablishStreamPlayingEvent(): void;
private setPermissionDialogTimer;
private clearPermissionDialogTimer;
}

View File

@ -1,564 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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 __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
var Session_1 = require("./Session");
var Stream_1 = require("./Stream");
var StreamManager_1 = require("./StreamManager");
var StreamEvent_1 = require("../OpenViduInternal/Events/StreamEvent");
var StreamPropertyChangedEvent_1 = require("../OpenViduInternal/Events/StreamPropertyChangedEvent");
var VideoElementEvent_1 = require("../OpenViduInternal/Events/VideoElementEvent");
var OpenViduError_1 = require("../OpenViduInternal/Enums/OpenViduError");
var platform = require("platform");
platform['isIonicIos'] = (platform.product === 'iPhone' || platform.product === 'iPad') && platform.ua.indexOf('Safari') === -1;
/**
* Packs local media streams. Participants can publish it to a session. Initialized with [[OpenVidu.initPublisher]] method
*/
var Publisher = /** @class */ (function (_super) {
__extends(Publisher, _super);
/**
* @hidden
*/
function Publisher(targEl, properties, openvidu) {
var _this = _super.call(this, new Stream_1.Stream((!!openvidu.session) ? openvidu.session : new Session_1.Session(openvidu), { publisherProperties: properties, mediaConstraints: {} }), targEl) || this;
/**
* Whether the Publisher has been granted access to the requested input devices or not
*/
_this.accessAllowed = false;
/**
* Whether you have called [[Publisher.subscribeToRemote]] with value `true` or `false` (*false* by default)
*/
_this.isSubscribedToRemote = false;
_this.accessDenied = false;
_this.properties = properties;
_this.openvidu = openvidu;
_this.stream.ee.on('local-stream-destroyed', function (reason) {
_this.stream.isLocalStreamPublished = false;
var streamEvent = new StreamEvent_1.StreamEvent(true, _this, 'streamDestroyed', _this.stream, reason);
_this.emitEvent('streamDestroyed', [streamEvent]);
streamEvent.callDefaultBehavior();
});
return _this;
}
/**
* Publish or unpublish the audio stream (if available). Calling this method twice in a row passing same value will have no effect
*
* #### Events dispatched
*
* > _Only if `Session.publish(Publisher)` has been called for this Publisher_
*
* The [[Session]] object of the local participant will dispatch a `streamPropertyChanged` event with `changedProperty` set to `"audioActive"` and `reason` set to `"publishAudio"`
* The [[Publisher]] object of the local participant will also dispatch the exact same event
*
* The [[Session]] object of every other participant connected to the session will dispatch a `streamPropertyChanged` event with `changedProperty` set to `"audioActive"` and `reason` set to `"publishAudio"`
* The respective [[Subscriber]] object of every other participant receiving this Publisher's stream will also dispatch the exact same event
*
* See [[StreamPropertyChangedEvent]] to learn more.
*
* @param value `true` to publish the audio stream, `false` to unpublish it
*/
Publisher.prototype.publishAudio = function (value) {
var _this = this;
if (this.stream.audioActive !== value) {
this.stream.getMediaStream().getAudioTracks().forEach(function (track) {
track.enabled = value;
});
if (!!this.session && !!this.stream.streamId) {
this.session.openvidu.sendRequest('streamPropertyChanged', {
streamId: this.stream.streamId,
property: 'audioActive',
newValue: value,
reason: 'publishAudio'
}, function (error, response) {
if (error) {
console.error("Error sending 'streamPropertyChanged' event", error);
}
else {
_this.session.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent_1.StreamPropertyChangedEvent(_this.session, _this.stream, 'audioActive', value, !value, 'publishAudio')]);
_this.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent_1.StreamPropertyChangedEvent(_this, _this.stream, 'audioActive', value, !value, 'publishAudio')]);
}
});
}
this.stream.audioActive = value;
console.info("'Publisher' has " + (value ? 'published' : 'unpublished') + ' its audio stream');
}
};
/**
* Publish or unpublish the video stream (if available). Calling this method twice in a row passing same value will have no effect
*
* #### Events dispatched
*
* > _Only if `Session.publish(Publisher)` has been called for this Publisher_
*
* The [[Session]] object of the local participant will dispatch a `streamPropertyChanged` event with `changedProperty` set to `"videoActive"` and `reason` set to `"publishVideo"`
* The [[Publisher]] object of the local participant will also dispatch the exact same event
*
* The [[Session]] object of every other participant connected to the session will dispatch a `streamPropertyChanged` event with `changedProperty` set to `"videoActive"` and `reason` set to `"publishVideo"`
* The respective [[Subscriber]] object of every other participant receiving this Publisher's stream will also dispatch the exact same event
*
* See [[StreamPropertyChangedEvent]] to learn more.
*
* @param value `true` to publish the video stream, `false` to unpublish it
*/
Publisher.prototype.publishVideo = function (value) {
var _this = this;
if (this.stream.videoActive !== value) {
this.stream.getMediaStream().getVideoTracks().forEach(function (track) {
track.enabled = value;
});
if (!!this.session && !!this.stream.streamId) {
this.session.openvidu.sendRequest('streamPropertyChanged', {
streamId: this.stream.streamId,
property: 'videoActive',
newValue: value,
reason: 'publishVideo'
}, function (error, response) {
if (error) {
console.error("Error sending 'streamPropertyChanged' event", error);
}
else {
_this.session.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent_1.StreamPropertyChangedEvent(_this.session, _this.stream, 'videoActive', value, !value, 'publishVideo')]);
_this.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent_1.StreamPropertyChangedEvent(_this, _this.stream, 'videoActive', value, !value, 'publishVideo')]);
}
});
}
this.stream.videoActive = value;
console.info("'Publisher' has " + (value ? 'published' : 'unpublished') + ' its video stream');
}
};
/**
* Call this method before [[Session.publish]] if you prefer to subscribe to your Publisher's remote stream instead of using the local stream, as any other user would do.
*/
Publisher.prototype.subscribeToRemote = function (value) {
value = (value !== undefined) ? value : true;
this.isSubscribedToRemote = value;
this.stream.subscribeToMyRemote(value);
};
/**
* See [[EventDispatcher.on]]
*/
Publisher.prototype.on = function (type, handler) {
var _this = this;
_super.prototype.on.call(this, type, handler);
if (type === 'streamCreated') {
if (!!this.stream && this.stream.isLocalStreamPublished) {
this.emitEvent('streamCreated', [new StreamEvent_1.StreamEvent(false, this, 'streamCreated', this.stream, '')]);
}
else {
this.stream.ee.on('stream-created-by-publisher', function () {
_this.emitEvent('streamCreated', [new StreamEvent_1.StreamEvent(false, _this, 'streamCreated', _this.stream, '')]);
});
}
}
if (type === 'remoteVideoPlaying') {
if (this.stream.displayMyRemote() && this.videos[0] && this.videos[0].video &&
this.videos[0].video.currentTime > 0 &&
this.videos[0].video.paused === false &&
this.videos[0].video.ended === false &&
this.videos[0].video.readyState === 4) {
this.emitEvent('remoteVideoPlaying', [new VideoElementEvent_1.VideoElementEvent(this.videos[0].video, this, 'remoteVideoPlaying')]);
}
}
if (type === 'accessAllowed') {
if (this.accessAllowed) {
this.emitEvent('accessAllowed', []);
}
}
if (type === 'accessDenied') {
if (this.accessDenied) {
this.emitEvent('accessDenied', []);
}
}
return this;
};
/**
* See [[EventDispatcher.once]]
*/
Publisher.prototype.once = function (type, handler) {
var _this = this;
_super.prototype.once.call(this, type, handler);
if (type === 'streamCreated') {
if (!!this.stream && this.stream.isLocalStreamPublished) {
this.emitEvent('streamCreated', [new StreamEvent_1.StreamEvent(false, this, 'streamCreated', this.stream, '')]);
}
else {
this.stream.ee.once('stream-created-by-publisher', function () {
_this.emitEvent('streamCreated', [new StreamEvent_1.StreamEvent(false, _this, 'streamCreated', _this.stream, '')]);
});
}
}
if (type === 'remoteVideoPlaying') {
if (this.stream.displayMyRemote() && this.videos[0] && this.videos[0].video &&
this.videos[0].video.currentTime > 0 &&
this.videos[0].video.paused === false &&
this.videos[0].video.ended === false &&
this.videos[0].video.readyState === 4) {
this.emitEvent('remoteVideoPlaying', [new VideoElementEvent_1.VideoElementEvent(this.videos[0].video, this, 'remoteVideoPlaying')]);
}
}
if (type === 'accessAllowed') {
if (this.accessAllowed) {
this.emitEvent('accessAllowed', []);
}
}
if (type === 'accessDenied') {
if (this.accessDenied) {
this.emitEvent('accessDenied', []);
}
}
return this;
};
/* Hidden methods */
/**
* @hidden
*/
Publisher.prototype.initialize = function () {
var _this = this;
return new Promise(function (resolve, reject) {
var errorCallback = function (openViduError) {
_this.accessDenied = true;
_this.accessAllowed = false;
reject(openViduError);
};
var successCallback = function (mediaStream) {
_this.accessAllowed = true;
_this.accessDenied = false;
if (_this.properties.audioSource instanceof MediaStreamTrack) {
mediaStream.removeTrack(mediaStream.getAudioTracks()[0]);
mediaStream.addTrack(_this.properties.audioSource);
}
if (_this.properties.videoSource instanceof MediaStreamTrack) {
mediaStream.removeTrack(mediaStream.getVideoTracks()[0]);
mediaStream.addTrack(_this.properties.videoSource);
}
// Apply PublisherProperties.publishAudio and PublisherProperties.publishVideo
if (!!mediaStream.getAudioTracks()[0]) {
var enabled = (_this.stream.audioActive !== undefined && _this.stream.audioActive !== null) ? _this.stream.audioActive : !!_this.stream.outboundStreamOpts.publisherProperties.publishAudio;
mediaStream.getAudioTracks()[0].enabled = enabled;
}
if (!!mediaStream.getVideoTracks()[0]) {
var enabled = (_this.stream.videoActive !== undefined && _this.stream.videoActive !== null) ? _this.stream.videoActive : !!_this.stream.outboundStreamOpts.publisherProperties.publishVideo;
mediaStream.getVideoTracks()[0].enabled = enabled;
}
_this.videoReference = document.createElement('video');
if (platform.name === 'Safari') {
_this.videoReference.setAttribute('playsinline', 'true');
}
_this.videoReference.srcObject = mediaStream;
_this.stream.setMediaStream(mediaStream);
if (!_this.stream.displayMyRemote()) {
// When we are subscribed to our remote we don't still set the MediaStream object in the video elements to
// avoid early 'streamPlaying' event
_this.stream.updateMediaStreamInVideos();
}
if (!!_this.firstVideoElement) {
_this.createVideoElement(_this.firstVideoElement.targetElement, _this.properties.insertMode);
}
delete _this.firstVideoElement;
if (_this.stream.isSendVideo()) {
if (!_this.stream.isSendScreen()) {
if (platform['isIonicIos'] || platform.name === 'Safari') {
// iOS Ionic or Safari. Limitation: cannot set videoDimensions directly, as the videoReference is not loaded
// if not added to DOM. Must add it to DOM and wait for videoWidth and videoHeight properties to be defined
_this.videoReference.style.display = 'none';
document.body.appendChild(_this.videoReference);
var videoDimensionsSet_1 = function () {
_this.stream.videoDimensions = {
width: _this.videoReference.videoWidth,
height: _this.videoReference.videoHeight
};
_this.stream.isLocalStreamReadyToPublish = true;
_this.stream.ee.emitEvent('stream-ready-to-publish', []);
document.body.removeChild(_this.videoReference);
};
var interval_1;
_this.videoReference.onloadedmetadata = function () {
if (_this.videoReference.videoWidth === 0) {
interval_1 = setInterval(function () {
if (_this.videoReference.videoWidth !== 0) {
videoDimensionsSet_1();
clearInterval(interval_1);
}
}, 10);
}
else {
videoDimensionsSet_1();
}
};
}
else {
// Rest of platforms
// With no screen share, video dimension can be set directly from MediaStream (getSettings)
// Orientation must be checked for mobile devices (width and height are reversed)
var _a = mediaStream.getVideoTracks()[0].getSettings(), width = _a.width, height = _a.height;
if ((platform.os.family === 'iOS' || platform.os.family === 'Android') && (window.innerHeight > window.innerWidth)) {
// Mobile portrait mode
_this.stream.videoDimensions = {
width: height || 0,
height: width || 0
};
}
else {
_this.stream.videoDimensions = {
width: width || 0,
height: height || 0
};
}
_this.stream.isLocalStreamReadyToPublish = true;
_this.stream.ee.emitEvent('stream-ready-to-publish', []);
}
}
else {
// With screen share, video dimension must be got from a video element (onloadedmetadata event)
_this.videoReference.onloadedmetadata = function () {
_this.stream.videoDimensions = {
width: _this.videoReference.videoWidth,
height: _this.videoReference.videoHeight
};
_this.screenShareResizeInterval = setInterval(function () {
var firefoxSettings = mediaStream.getVideoTracks()[0].getSettings();
var newWidth = (platform.name === 'Chrome' || platform.name === 'Opera') ? _this.videoReference.videoWidth : firefoxSettings.width;
var newHeight = (platform.name === 'Chrome' || platform.name === 'Opera') ? _this.videoReference.videoHeight : firefoxSettings.height;
if (_this.stream.isLocalStreamPublished &&
(newWidth !== _this.stream.videoDimensions.width ||
newHeight !== _this.stream.videoDimensions.height)) {
var oldValue_1 = { width: _this.stream.videoDimensions.width, height: _this.stream.videoDimensions.height };
_this.stream.videoDimensions = {
width: newWidth || 0,
height: newHeight || 0
};
_this.session.openvidu.sendRequest('streamPropertyChanged', {
streamId: _this.stream.streamId,
property: 'videoDimensions',
newValue: JSON.stringify(_this.stream.videoDimensions),
reason: 'screenResized'
}, function (error, response) {
if (error) {
console.error("Error sending 'streamPropertyChanged' event", error);
}
else {
_this.session.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent_1.StreamPropertyChangedEvent(_this.session, _this.stream, 'videoDimensions', _this.stream.videoDimensions, oldValue_1, 'screenResized')]);
_this.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent_1.StreamPropertyChangedEvent(_this, _this.stream, 'videoDimensions', _this.stream.videoDimensions, oldValue_1, 'screenResized')]);
}
});
}
}, 500);
_this.stream.isLocalStreamReadyToPublish = true;
_this.stream.ee.emitEvent('stream-ready-to-publish', []);
};
}
}
else {
_this.stream.isLocalStreamReadyToPublish = true;
_this.stream.ee.emitEvent('stream-ready-to-publish', []);
}
resolve();
};
// Check if new constraints need to be generated. No constraints needed if
// - video track is given and no audio
// - audio track is given and no video
// - both video and audio tracks are given
if ((_this.properties.videoSource instanceof MediaStreamTrack && !_this.properties.audioSource)
|| (_this.properties.audioSource instanceof MediaStreamTrack && !_this.properties.videoSource)
|| (_this.properties.videoSource instanceof MediaStreamTrack && _this.properties.audioSource instanceof MediaStreamTrack)) {
var mediaStream = new MediaStream();
if (_this.properties.videoSource instanceof MediaStreamTrack) {
mediaStream.addTrack(_this.properties.videoSource);
}
if (_this.properties.audioSource instanceof MediaStreamTrack) {
mediaStream.addTrack(_this.properties.audioSource);
}
// MediaStreamTracks are handled within callback - just call callback with new MediaStream() and let it handle the sources
successCallback(mediaStream);
// Return as we do not need to process further
return;
}
_this.openvidu.generateMediaConstraints(_this.properties)
.then(function (constraints) {
var outboundStreamOptions = {
mediaConstraints: constraints,
publisherProperties: _this.properties
};
_this.stream.setOutboundStreamOptions(outboundStreamOptions);
var constraintsAux = {};
var timeForDialogEvent = 1250;
if (_this.stream.isSendVideo() || _this.stream.isSendAudio()) {
var definedAudioConstraint_1 = ((constraints.audio === undefined) ? true : constraints.audio);
constraintsAux.audio = _this.stream.isSendScreen() ? false : definedAudioConstraint_1;
constraintsAux.video = constraints.video;
var startTime_1 = Date.now();
_this.setPermissionDialogTimer(timeForDialogEvent);
navigator.mediaDevices.getUserMedia(constraintsAux)
.then(function (mediaStream) {
_this.clearPermissionDialogTimer(startTime_1, timeForDialogEvent);
if (_this.stream.isSendScreen() && _this.stream.isSendAudio()) {
// When getting desktop as user media audio constraint must be false. Now we can ask for it if required
constraintsAux.audio = definedAudioConstraint_1;
constraintsAux.video = false;
startTime_1 = Date.now();
_this.setPermissionDialogTimer(timeForDialogEvent);
navigator.mediaDevices.getUserMedia(constraintsAux)
.then(function (audioOnlyStream) {
_this.clearPermissionDialogTimer(startTime_1, timeForDialogEvent);
mediaStream.addTrack(audioOnlyStream.getAudioTracks()[0]);
successCallback(mediaStream);
})["catch"](function (error) {
_this.clearPermissionDialogTimer(startTime_1, timeForDialogEvent);
if (error.name === 'Error') {
// Safari OverConstrainedError has as name property 'Error' instead of 'OverConstrainedError'
error.name = error.constructor.name;
}
var errorName, errorMessage;
switch (error.name.toLowerCase()) {
case 'notfounderror':
errorName = OpenViduError_1.OpenViduErrorName.INPUT_AUDIO_DEVICE_NOT_FOUND;
errorMessage = error.toString();
errorCallback(new OpenViduError_1.OpenViduError(errorName, errorMessage));
break;
case 'notallowederror':
errorName = OpenViduError_1.OpenViduErrorName.DEVICE_ACCESS_DENIED;
errorMessage = error.toString();
errorCallback(new OpenViduError_1.OpenViduError(errorName, errorMessage));
break;
case 'overconstrainederror':
if (error.constraint.toLowerCase() === 'deviceid') {
errorName = OpenViduError_1.OpenViduErrorName.INPUT_AUDIO_DEVICE_NOT_FOUND;
errorMessage = "Audio input device with deviceId '" + constraints.video.deviceId.exact + "' not found";
}
else {
errorName = OpenViduError_1.OpenViduErrorName.PUBLISHER_PROPERTIES_ERROR;
errorMessage = "Audio input device doesn't support the value passed for constraint '" + error.constraint + "'";
}
errorCallback(new OpenViduError_1.OpenViduError(errorName, errorMessage));
break;
}
});
}
else {
successCallback(mediaStream);
}
})["catch"](function (error) {
_this.clearPermissionDialogTimer(startTime_1, timeForDialogEvent);
if (error.name === 'Error') {
// Safari OverConstrainedError has as name property 'Error' instead of 'OverConstrainedError'
error.name = error.constructor.name;
}
var errorName, errorMessage;
switch (error.name.toLowerCase()) {
case 'notfounderror':
navigator.mediaDevices.getUserMedia({
audio: false,
video: constraints.video
})
.then(function (mediaStream) {
mediaStream.getVideoTracks().forEach(function (track) {
track.stop();
});
errorName = OpenViduError_1.OpenViduErrorName.INPUT_AUDIO_DEVICE_NOT_FOUND;
errorMessage = error.toString();
errorCallback(new OpenViduError_1.OpenViduError(errorName, errorMessage));
})["catch"](function (e) {
errorName = OpenViduError_1.OpenViduErrorName.INPUT_VIDEO_DEVICE_NOT_FOUND;
errorMessage = error.toString();
errorCallback(new OpenViduError_1.OpenViduError(errorName, errorMessage));
});
break;
case 'notallowederror':
errorName = _this.stream.isSendScreen() ? OpenViduError_1.OpenViduErrorName.SCREEN_CAPTURE_DENIED : OpenViduError_1.OpenViduErrorName.DEVICE_ACCESS_DENIED;
errorMessage = error.toString();
errorCallback(new OpenViduError_1.OpenViduError(errorName, errorMessage));
break;
case 'overconstrainederror':
navigator.mediaDevices.getUserMedia({
audio: false,
video: constraints.video
})
.then(function (mediaStream) {
mediaStream.getVideoTracks().forEach(function (track) {
track.stop();
});
if (error.constraint.toLowerCase() === 'deviceid') {
errorName = OpenViduError_1.OpenViduErrorName.INPUT_AUDIO_DEVICE_NOT_FOUND;
errorMessage = "Audio input device with deviceId '" + constraints.audio.deviceId.exact + "' not found";
}
else {
errorName = OpenViduError_1.OpenViduErrorName.PUBLISHER_PROPERTIES_ERROR;
errorMessage = "Audio input device doesn't support the value passed for constraint '" + error.constraint + "'";
}
errorCallback(new OpenViduError_1.OpenViduError(errorName, errorMessage));
})["catch"](function (e) {
if (error.constraint.toLowerCase() === 'deviceid') {
errorName = OpenViduError_1.OpenViduErrorName.INPUT_VIDEO_DEVICE_NOT_FOUND;
errorMessage = "Video input device with deviceId '" + constraints.video.deviceId.exact + "' not found";
}
else {
errorName = OpenViduError_1.OpenViduErrorName.PUBLISHER_PROPERTIES_ERROR;
errorMessage = "Video input device doesn't support the value passed for constraint '" + error.constraint + "'";
}
errorCallback(new OpenViduError_1.OpenViduError(errorName, errorMessage));
});
break;
}
});
}
else {
reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.NO_INPUT_SOURCE_SET, "Properties 'audioSource' and 'videoSource' cannot be set to false or null at the same time when calling 'OpenVidu.initPublisher'"));
}
})["catch"](function (error) {
errorCallback(error);
});
});
};
/**
* @hidden
*/
Publisher.prototype.reestablishStreamPlayingEvent = function () {
if (this.ee.getListeners('streamPlaying').length > 0) {
this.addPlayEventToFirstVideo();
}
};
/* Private methods */
Publisher.prototype.setPermissionDialogTimer = function (waitTime) {
var _this = this;
this.permissionDialogTimeout = setTimeout(function () {
_this.emitEvent('accessDialogOpened', []);
}, waitTime);
};
Publisher.prototype.clearPermissionDialogTimer = function (startTime, waitTime) {
clearTimeout(this.permissionDialogTimeout);
if ((Date.now() - startTime) > waitTime) {
// Permission dialog was shown and now is closed
this.emitEvent('accessDialogClosed', []);
}
};
return Publisher;
}(StreamManager_1.StreamManager));
exports.Publisher = Publisher;
//# sourceMappingURL=Publisher.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,293 +0,0 @@
import { Connection } from './Connection';
import { OpenVidu } from './OpenVidu';
import { Publisher } from './Publisher';
import { Stream } from './Stream';
import { StreamManager } from './StreamManager';
import { Subscriber } from './Subscriber';
import { Capabilities } from '../OpenViduInternal/Interfaces/Public/Capabilities';
import { EventDispatcher } from '../OpenViduInternal/Interfaces/Public/EventDispatcher';
import { SignalOptions } from '../OpenViduInternal/Interfaces/Public/SignalOptions';
import { SubscriberProperties } from '../OpenViduInternal/Interfaces/Public/SubscriberProperties';
import { ConnectionOptions } from '../OpenViduInternal/Interfaces/Private/ConnectionOptions';
import { ObjMap } from '../OpenViduInternal/Interfaces/Private/ObjMap';
import { SessionOptions } from '../OpenViduInternal/Interfaces/Private/SessionOptions';
import { ConnectionEvent } from '../OpenViduInternal/Events/ConnectionEvent';
import { PublisherSpeakingEvent } from '../OpenViduInternal/Events/PublisherSpeakingEvent';
import { RecordingEvent } from '../OpenViduInternal/Events/RecordingEvent';
import { SessionDisconnectedEvent } from '../OpenViduInternal/Events/SessionDisconnectedEvent';
import { SignalEvent } from '../OpenViduInternal/Events/SignalEvent';
import { StreamEvent } from '../OpenViduInternal/Events/StreamEvent';
/**
* Represents a video call. It can also be seen as a videoconference room where multiple users can connect.
* Participants who publish their videos to a session can be seen by the rest of users connected to that specific session.
* Initialized with [[OpenVidu.initSession]] method
*/
export declare class Session implements EventDispatcher {
/**
* Local connection to the Session. This object is defined only after [[Session.connect]] has been successfully executed, and can be retrieved subscribing to `connectionCreated` event
*/
connection: Connection;
/**
* Unique identifier of the Session
*/
sessionId: string;
/**
* Collection of all StreamManagers of this Session ([[Publisher]] and [[Subscriber]])
*/
streamManagers: StreamManager[];
/**
* Object defining the methods that the client is able to call. These are defined by the role of the token used to connect to the Session.
* This object is only defined after [[Session.connect]] has been successfully resolved
*/
capabilities: Capabilities;
/**
* @hidden
*/
remoteStreamsCreated: ObjMap<boolean>;
/**
* @hidden
*/
isFirstIonicIosSubscriber: boolean;
/**
* @hidden
*/
countDownForIonicIosSubscribers: boolean;
/**
* @hidden
*/
remoteConnections: ObjMap<Connection>;
/**
* @hidden
*/
openvidu: OpenVidu;
/**
* @hidden
*/
options: SessionOptions;
/**
* @hidden
*/
speakingEventsEnabled: boolean;
private ee;
/**
* @hidden
*/
constructor(openvidu: OpenVidu);
connect(token: string): Promise<any>;
connect(token: string, metadata: any): Promise<any>;
/**
* Leaves the session, destroying all streams and deleting the user as a participant.
*
* #### Events dispatched
*
* The [[Session]] object of the local participant will dispatch a `sessionDisconnected` event.
* This event will automatically unsubscribe the leaving participant from every Subscriber object of the session (this includes closing the WebRTCPeer connection and disposing all MediaStreamTracks)
* and also deletes any HTML video element associated to each Subscriber (only those [created by OpenVidu Browser](/docs/how-do-i/manage-videos/#let-openvidu-take-care-of-the-video-players)).
* For every video removed, each Subscriber object will dispatch a `videoElementDestroyed` event.
* Call `event.preventDefault()` upon event `sessionDisconnected` to avoid this behavior and take care of disposing and cleaning all the Subscriber objects yourself.
* See [[SessionDisconnectedEvent]] and [[VideoElementEvent]] to learn more to learn more.
*
* The [[Publisher]] object of the local participant will dispatch a `streamDestroyed` event if there is a [[Publisher]] object publishing to the session.
* This event will automatically stop all media tracks and delete any HTML video element associated to it (only those [created by OpenVidu Browser](/docs/how-do-i/manage-videos/#let-openvidu-take-care-of-the-video-players)).
* For every video removed, the Publisher object will dispatch a `videoElementDestroyed` event.
* Call `event.preventDefault()` upon event `streamDestroyed` if you want to clean the Publisher object on your own or re-publish it in a different Session (to do so it is a mandatory requirement to call `Session.unpublish()`
* or/and `Session.disconnect()` in the previous session). See [[StreamEvent]] and [[VideoElementEvent]] to learn more.
*
* The [[Session]] object of every other participant connected to the session will dispatch a `streamDestroyed` event if the disconnected participant was publishing.
* This event will automatically unsubscribe the Subscriber object from the session (this includes closing the WebRTCPeer connection and disposing all MediaStreamTracks)
* and also deletes any HTML video element associated to that Subscriber (only those [created by OpenVidu Browser](/docs/how-do-i/manage-videos/#let-openvidu-take-care-of-the-video-players)).
* For every video removed, the Subscriber object will dispatch a `videoElementDestroyed` event.
* Call `event.preventDefault()` upon event `streamDestroyed` to avoid this default behavior and take care of disposing and cleaning the Subscriber object yourself.
* See [[StreamEvent]] and [[VideoElementEvent]] to learn more.
*
* The [[Session]] object of every other participant connected to the session will dispatch a `connectionDestroyed` event in any case. See [[ConnectionEvent]] to learn more.
*/
disconnect(): void;
subscribe(stream: Stream, targetElement: string | HTMLElement): Subscriber;
subscribe(stream: Stream, targetElement: string | HTMLElement, properties: SubscriberProperties): Subscriber;
subscribe(stream: Stream, targetElement: string | HTMLElement, completionHandler: (error: Error | undefined) => void): Subscriber;
subscribe(stream: Stream, targetElement: string | HTMLElement, properties: SubscriberProperties, completionHandler: (error: Error | undefined) => void): Subscriber;
/**
* Promisified version of [[Session.subscribe]]
*/
subscribeAsync(stream: Stream, targetElement: string | HTMLElement): Promise<Subscriber>;
subscribeAsync(stream: Stream, targetElement: string | HTMLElement, properties: SubscriberProperties): Promise<Subscriber>;
/**
* Unsubscribes from `subscriber`, automatically removing its associated HTML video elements.
*
* #### Events dispatched
*
* The [[Subscriber]] object will dispatch a `videoElementDestroyed` event for each video associated to it that was removed from DOM.
* Only videos [created by OpenVidu Browser](/docs/how-do-i/manage-videos/#let-openvidu-take-care-of-the-video-players)) will be automatically removed
*
* See [[VideoElementEvent]] to learn more
*/
unsubscribe(subscriber: Subscriber): void;
/**
* Publishes to the Session the Publisher object
*
* #### Events dispatched
*
* The local [[Publisher]] object will dispatch a `streamCreated` event upon successful termination of this method. See [[StreamEvent]] to learn more.
*
* The local [[Publisher]] object will dispatch a `streamPlaying` once the media stream starts playing. See [[StreamManagerEvent]] to learn more.
*
* The [[Session]] object of every other participant connected to the session will dispatch a `streamCreated` event so they can subscribe to it. See [[StreamEvent]] to learn more.
*
* @returns A Promise (to which you can optionally subscribe to) that is resolved only after the publisher was successfully published and rejected with an Error object if not
*/
publish(publisher: Publisher): Promise<any>;
/**
* Unpublishes from the Session the Publisher object.
*
* #### Events dispatched
*
* The [[Publisher]] object of the local participant will dispatch a `streamDestroyed` event.
* This event will automatically stop all media tracks and delete any HTML video element associated to this Publisher
* (only those videos [created by OpenVidu Browser](/docs/how-do-i/manage-videos/#let-openvidu-take-care-of-the-video-players)).
* For every video removed, the Publisher object will dispatch a `videoElementDestroyed` event.
* Call `event.preventDefault()` upon event `streamDestroyed` if you want to clean the Publisher object on your own or re-publish it in a different Session.
*
* The [[Session]] object of every other participant connected to the session will dispatch a `streamDestroyed` event.
* This event will automatically unsubscribe the Subscriber object from the session (this includes closing the WebRTCPeer connection and disposing all MediaStreamTracks) and
* delete any HTML video element associated to it (only those [created by OpenVidu Browser](/docs/how-do-i/manage-videos/#let-openvidu-take-care-of-the-video-players)).
* For every video removed, the Subscriber object will dispatch a `videoElementDestroyed` event.
* Call `event.preventDefault()` upon event `streamDestroyed` to avoid this default behavior and take care of disposing and cleaning the Subscriber object on your own.
*
* See [[StreamEvent]] and [[VideoElementEvent]] to learn more.
*/
unpublish(publisher: Publisher): void;
/**
* Forces some user to leave the session
*
* #### Events dispatched
*
* The behavior is the same as when some user calls [[Session.disconnect]], but `reason` property in all events will be `"forceDisconnectByUser"`.
*
* The [[Session]] object of every participant will dispatch a `streamDestroyed` event if the evicted user was publishing a stream, with property `reason` set to `"forceDisconnectByUser"`.
* The [[Session]] object of every participant except the evicted one will dispatch a `connectionDestroyed` event for the evicted user, with property `reason` set to `"forceDisconnectByUser"`.
*
* If any, the [[Publisher]] object of the evicted participant will also dispatch a `streamDestroyed` event with property `reason` set to `"forceDisconnectByUser"`.
* The [[Session]] object of the evicted participant will dispatch a `sessionDisconnected` event with property `reason` set to `"forceDisconnectByUser"`.
*
* See [[StreamEvent]], [[ConnectionEvent]] and [[SessionDisconnectedEvent]] to learn more.
*
* @returns A Promise (to which you can optionally subscribe to) that is resolved only after the participant has been successfully evicted from the session and rejected with an Error object if not
*/
forceDisconnect(connection: Connection): Promise<any>;
/**
* Forces some user to unpublish a Stream
*
* #### Events dispatched
*
* The behavior is the same as when some user calls [[Session.unpublish]], but `reason` property in all events will be `"forceUnpublishByUser"`
*
* The [[Session]] object of every participant will dispatch a `streamDestroyed` event with property `reason` set to `"forceDisconnectByUser"`
*
* The [[Publisher]] object of the affected participant will also dispatch a `streamDestroyed` event with property `reason` set to `"forceDisconnectByUser"`
*
* See [[StreamEvent]] to learn more.
*
* @returns A Promise (to which you can optionally subscribe to) that is resolved only after the remote Stream has been successfully unpublished from the session and rejected with an Error object if not
*/
forceUnpublish(stream: Stream): Promise<any>;
/**
* Sends one signal. `signal` object has the following optional properties:
* ```json
* {data:string, to:Connection[], type:string}
* ```
* All users subscribed to that signal (`session.on('signal:type', ...)` or `session.on('signal', ...)` for all signals) and whose Connection objects are in `to` array will receive it. Their local
* Session objects will dispatch a `signal` or `signal:type` event. See [[SignalEvent]] to learn more.
*
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the message successfully reached openvidu-server and rejected with an Error object if not. _This doesn't
* mean that openvidu-server could resend the message to all the listed receivers._
*/
signal(signal: SignalOptions): Promise<any>;
/**
* See [[EventDispatcher.on]]
*/
on(type: string, handler: (event: SessionDisconnectedEvent | SignalEvent | StreamEvent | ConnectionEvent | PublisherSpeakingEvent | RecordingEvent) => void): EventDispatcher;
/**
* See [[EventDispatcher.once]]
*/
once(type: string, handler: (event: SessionDisconnectedEvent | SignalEvent | StreamEvent | ConnectionEvent | PublisherSpeakingEvent | RecordingEvent) => void): Session;
/**
* See [[EventDispatcher.off]]
*/
off(type: string, handler?: (event: SessionDisconnectedEvent | SignalEvent | StreamEvent | ConnectionEvent | PublisherSpeakingEvent | RecordingEvent) => void): Session;
/**
* @hidden
*/
onParticipantJoined(response: ConnectionOptions): void;
/**
* @hidden
*/
onParticipantLeft(msg: any): void;
/**
* @hidden
*/
onParticipantPublished(response: ConnectionOptions): void;
/**
* @hidden
*/
onParticipantUnpublished(msg: any): void;
/**
* @hidden
*/
onParticipantEvicted(msg: any): void;
/**
* @hidden
*/
onNewMessage(msg: any): void;
/**
* @hidden
*/
onStreamPropertyChanged(msg: any): void;
/**
* @hidden
*/
recvIceCandidate(msg: any): void;
/**
* @hidden
*/
onSessionClosed(msg: any): void;
/**
* @hidden
*/
onLostConnection(): void;
/**
* @hidden
*/
onRecoveredConnection(): void;
/**
* @hidden
*/
onMediaError(params: any): void;
/**
* @hidden
*/
onRecordingStarted(response: any): void;
/**
* @hidden
*/
onRecordingStopped(response: any): void;
/**
* @hidden
* response = {connectionId: string, streamId: string, type: string, data: Object}
*/
onFilterEventDispatched(response: any): void;
/**
* @hidden
*/
emitEvent(type: string, eventArray: any[]): void;
/**
* @hidden
*/
leave(forced: boolean, reason: string): void;
private connectAux;
private stopPublisherStream;
private stringClientMetadata;
private getConnection;
private getRemoteConnection;
private processToken;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,273 +0,0 @@
import { Connection } from './Connection';
import { Event } from '../OpenViduInternal/Events/Event';
import { Filter } from './Filter';
import { Session } from './Session';
import { StreamManager } from './StreamManager';
import { EventDispatcher } from '../OpenViduInternal/Interfaces/Public/EventDispatcher';
import { InboundStreamOptions } from '../OpenViduInternal/Interfaces/Private/InboundStreamOptions';
import { OutboundStreamOptions } from '../OpenViduInternal/Interfaces/Private/OutboundStreamOptions';
import { WebRtcPeer } from '../OpenViduInternal/WebRtcPeer/WebRtcPeer';
import EventEmitter = require('wolfy87-eventemitter');
/**
* Represents each one of the media streams available in OpenVidu Server for certain session.
* Each [[Publisher]] and [[Subscriber]] has an attribute of type Stream, as they give access
* to one of them (sending and receiving it, respectively)
*/
export declare class Stream implements EventDispatcher {
/**
* The Connection object that is publishing the stream
*/
connection: Connection;
/**
* Frame rate of the video in frames per second. This property is only defined if the [[Publisher]] of
* the stream was initialized passing a _frameRate_ property on [[OpenVidu.initPublisher]] method
*/
frameRate?: number;
/**
* Whether the stream has a video track or not
*/
hasVideo: boolean;
/**
* Whether the stream has an audio track or not
*/
hasAudio: boolean;
/**
* Whether the stream has the video track muted or unmuted. If [[hasVideo]] is false, this property is undefined.
*
* This property may change if the Publisher publishing the stream calls [[Publisher.publishVideo]]. Whenever this happens a [[StreamPropertyChangedEvent]] will be dispatched
* by the Session object as well as by the affected Subscriber/Publisher object
*/
videoActive: boolean;
/**
* Whether the stream has the audio track muted or unmuted. If [[hasAudio]] is false, this property is undefined
*
* This property may change if the Publisher publishing the stream calls [[Publisher.publishAudio]]. Whenever this happens a [[StreamPropertyChangedEvent]] will be dispatched
* by the Session object as well as by the affected Subscriber/Publisher object
*/
audioActive: boolean;
/**
* Unique identifier of the stream. If the stream belongs to a...
* - Subscriber object: property `streamId` is always defined
* - Publisher object: property `streamId` is only defined after successful execution of [[Session.publish]]
*/
streamId: string;
/**
* `"CAMERA"`, `"SCREEN"` or `"CUSTOM"` (the latter when [[PublisherProperties.videoSource]] is a MediaStreamTrack when calling [[OpenVidu.initPublisher]]).
* If [[hasVideo]] is false, this property is undefined
*/
typeOfVideo?: string;
/**
* StreamManager object ([[Publisher]] or [[Subscriber]]) in charge of displaying this stream in the DOM
*/
streamManager: StreamManager;
/**
* Width and height in pixels of the encoded video stream. If [[hasVideo]] is false, this property is undefined
*
* This property may change if the Publisher that is publishing:
* - If it is a mobile device, whenever the user rotates the device.
* - If it is screen-sharing, whenever the user changes the size of the captured window.
*
* Whenever this happens a [[StreamPropertyChangedEvent]] will be dispatched by the Session object as well as by the affected Subscriber/Publisher object
*/
videoDimensions: {
width: number;
height: number;
};
/**
* **WARNING**: experimental option. This interface may change in the near future
*
* Filter applied to the Stream. You can apply filters by calling [[Stream.applyFilter]], execute methods of the applied filter with
* [[Filter.execMethod]] and remove it with [[Stream.removeFilter]]. Be aware that the client calling this methods must have the
* necessary permissions: the token owned by the client must have been initialized with the appropriated `allowedFilters` array.
*/
filter: Filter;
/**
* @hidden
*/
ee: EventEmitter;
private webRtcPeer;
private mediaStream;
private webRtcStats;
private isSubscribeToRemote;
/**
* @hidden
*/
isLocalStreamReadyToPublish: boolean;
/**
* @hidden
*/
isLocalStreamPublished: boolean;
/**
* @hidden
*/
publishedOnce: boolean;
/**
* @hidden
*/
session: Session;
/**
* @hidden
*/
inboundStreamOpts: InboundStreamOptions;
/**
* @hidden
*/
outboundStreamOpts: OutboundStreamOptions;
/**
* @hidden
*/
speechEvent: any;
/**
* @hidden
*/
publisherStartSpeakingEventEnabled: boolean;
/**
* @hidden
*/
publisherStopSpeakingEventEnabled: boolean;
/**
* @hidden
*/
volumeChangeEventEnabled: boolean;
/**
* @hidden
*/
constructor(session: Session, options: InboundStreamOptions | OutboundStreamOptions | {});
/**
* See [[EventDispatcher.on]]
*/
on(type: string, handler: (event: Event) => void): EventDispatcher;
/**
* See [[EventDispatcher.once]]
*/
once(type: string, handler: (event: Event) => void): EventDispatcher;
/**
* See [[EventDispatcher.off]]
*/
off(type: string, handler?: (event: Event) => void): EventDispatcher;
/**
* Applies an audio/video filter to the stream.
*
* @param type Type of filter applied. See [[Filter.type]]
* @param options Parameters used to initialize the filter. See [[Filter.options]]
*
* @returns A Promise (to which you can optionally subscribe to) that is resolved to the applied filter if success and rejected with an Error object if not
*/
applyFilter(type: string, options: Object): Promise<Filter>;
/**
* Removes an audio/video filter previously applied.
*
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the previously applied filter has been successfully removed and rejected with an Error object in other case
*/
removeFilter(): Promise<any>;
/**
* @hidden
*/
getMediaStream(): MediaStream;
/**
* @hidden
*/
setMediaStream(mediaStream: MediaStream): void;
/**
* @hidden
*/
updateMediaStreamInVideos(): void;
/**
* @hidden
*/
getWebRtcPeer(): WebRtcPeer;
/**
* @hidden
*/
getRTCPeerConnection(): RTCPeerConnection;
/**
* @hidden
*/
subscribeToMyRemote(value: boolean): void;
/**
* @hidden
*/
setOutboundStreamOptions(outboundStreamOpts: OutboundStreamOptions): void;
/**
* @hidden
*/
subscribe(): Promise<any>;
/**
* @hidden
*/
publish(): Promise<any>;
/**
* @hidden
*/
disposeWebRtcPeer(): void;
/**
* @hidden
*/
disposeMediaStream(): void;
/**
* @hidden
*/
displayMyRemote(): boolean;
/**
* @hidden
*/
isSendAudio(): boolean;
/**
* @hidden
*/
isSendVideo(): boolean;
/**
* @hidden
*/
isSendScreen(): boolean;
/**
* @hidden
*/
setSpeechEventIfNotExists(): void;
/**
* @hidden
*/
enableSpeakingEvents(): void;
/**
* @hidden
*/
enableOnceSpeakingEvents(): void;
/**
* @hidden
*/
disableSpeakingEvents(): void;
/**
* @hidden
*/
enableVolumeChangeEvent(): void;
/**
* @hidden
*/
enableOnceVolumeChangeEvent(): void;
/**
* @hidden
*/
disableVolumeChangeEvent(): void;
/**
* @hidden
*/
isLocal(): boolean;
/**
* @hidden
*/
getSelectedIceCandidate(): Promise<any>;
/**
* @hidden
*/
getRemoteIceCandidateList(): RTCIceCandidate[];
/**
* @hidden
*/
getLocalIceCandidateList(): RTCIceCandidate[];
private initWebRtcPeerSend;
private initWebRtcPeerReceive;
private remotePeerSuccessfullyEstablished;
private initWebRtcStats;
private stopWebRtcStats;
private getIceServersConf;
}

View File

@ -1,700 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
var Filter_1 = require("./Filter");
var WebRtcPeer_1 = require("../OpenViduInternal/WebRtcPeer/WebRtcPeer");
var WebRtcStats_1 = require("../OpenViduInternal/WebRtcStats/WebRtcStats");
var PublisherSpeakingEvent_1 = require("../OpenViduInternal/Events/PublisherSpeakingEvent");
var StreamManagerEvent_1 = require("../OpenViduInternal/Events/StreamManagerEvent");
var StreamPropertyChangedEvent_1 = require("../OpenViduInternal/Events/StreamPropertyChangedEvent");
var OpenViduError_1 = require("../OpenViduInternal/Enums/OpenViduError");
var EventEmitter = require("wolfy87-eventemitter");
var hark = require("hark");
var platform = require("platform");
platform['isIonicIos'] = (platform.product === 'iPhone' || platform.product === 'iPad') && platform.ua.indexOf('Safari') === -1;
/**
* Represents each one of the media streams available in OpenVidu Server for certain session.
* Each [[Publisher]] and [[Subscriber]] has an attribute of type Stream, as they give access
* to one of them (sending and receiving it, respectively)
*/
var Stream = /** @class */ (function () {
/**
* @hidden
*/
function Stream(session, options) {
var _this = this;
/**
* @hidden
*/
this.ee = new EventEmitter();
this.isSubscribeToRemote = false;
/**
* @hidden
*/
this.isLocalStreamReadyToPublish = false;
/**
* @hidden
*/
this.isLocalStreamPublished = false;
/**
* @hidden
*/
this.publishedOnce = false;
/**
* @hidden
*/
this.publisherStartSpeakingEventEnabled = false;
/**
* @hidden
*/
this.publisherStopSpeakingEventEnabled = false;
/**
* @hidden
*/
this.volumeChangeEventEnabled = false;
this.session = session;
if (options.hasOwnProperty('id')) {
// InboundStreamOptions: stream belongs to a Subscriber
this.inboundStreamOpts = options;
this.streamId = this.inboundStreamOpts.id;
this.hasAudio = this.inboundStreamOpts.hasAudio;
this.hasVideo = this.inboundStreamOpts.hasVideo;
if (this.hasAudio) {
this.audioActive = this.inboundStreamOpts.audioActive;
}
if (this.hasVideo) {
this.videoActive = this.inboundStreamOpts.videoActive;
this.typeOfVideo = (!this.inboundStreamOpts.typeOfVideo) ? undefined : this.inboundStreamOpts.typeOfVideo;
this.frameRate = (this.inboundStreamOpts.frameRate === -1) ? undefined : this.inboundStreamOpts.frameRate;
this.videoDimensions = this.inboundStreamOpts.videoDimensions;
}
if (!!this.inboundStreamOpts.filter && (Object.keys(this.inboundStreamOpts.filter).length > 0)) {
if (!!this.inboundStreamOpts.filter.lastExecMethod && Object.keys(this.inboundStreamOpts.filter.lastExecMethod).length === 0) {
delete this.inboundStreamOpts.filter.lastExecMethod;
}
this.filter = this.inboundStreamOpts.filter;
}
}
else {
// OutboundStreamOptions: stream belongs to a Publisher
this.outboundStreamOpts = options;
this.hasAudio = this.isSendAudio();
this.hasVideo = this.isSendVideo();
if (this.hasAudio) {
this.audioActive = !!this.outboundStreamOpts.publisherProperties.publishAudio;
}
if (this.hasVideo) {
this.videoActive = !!this.outboundStreamOpts.publisherProperties.publishVideo;
this.frameRate = this.outboundStreamOpts.publisherProperties.frameRate;
if (this.outboundStreamOpts.publisherProperties.videoSource instanceof MediaStreamTrack) {
this.typeOfVideo = 'CUSTOM';
}
else {
this.typeOfVideo = this.isSendScreen() ? 'SCREEN' : 'CAMERA';
}
}
if (!!this.outboundStreamOpts.publisherProperties.filter) {
this.filter = this.outboundStreamOpts.publisherProperties.filter;
}
}
this.ee.on('mediastream-updated', function () {
_this.streamManager.updateMediaStream(_this.mediaStream);
console.debug('Video srcObject [' + _this.mediaStream + '] updated in stream [' + _this.streamId + ']');
});
}
/**
* See [[EventDispatcher.on]]
*/
Stream.prototype.on = function (type, handler) {
var _this = this;
this.ee.on(type, function (event) {
if (event) {
console.info("Event '" + type + "' triggered by stream '" + _this.streamId + "'", event);
}
else {
console.info("Event '" + type + "' triggered by stream '" + _this.streamId + "'");
}
handler(event);
});
return this;
};
/**
* See [[EventDispatcher.once]]
*/
Stream.prototype.once = function (type, handler) {
var _this = this;
this.ee.once(type, function (event) {
if (event) {
console.info("Event '" + type + "' triggered once by stream '" + _this.streamId + "'", event);
}
else {
console.info("Event '" + type + "' triggered once by stream '" + _this.streamId + "'");
}
handler(event);
});
return this;
};
/**
* See [[EventDispatcher.off]]
*/
Stream.prototype.off = function (type, handler) {
if (!handler) {
this.ee.removeAllListeners(type);
}
else {
this.ee.off(type, handler);
}
return this;
};
/**
* Applies an audio/video filter to the stream.
*
* @param type Type of filter applied. See [[Filter.type]]
* @param options Parameters used to initialize the filter. See [[Filter.options]]
*
* @returns A Promise (to which you can optionally subscribe to) that is resolved to the applied filter if success and rejected with an Error object if not
*/
Stream.prototype.applyFilter = function (type, options) {
var _this = this;
return new Promise(function (resolve, reject) {
console.info('Applying filter to stream ' + _this.streamId);
options = !!options ? options : {};
if (typeof options !== 'string') {
options = JSON.stringify(options);
}
_this.session.openvidu.sendRequest('applyFilter', { streamId: _this.streamId, type: type, options: options }, function (error, response) {
if (error) {
console.error('Error applying filter for Stream ' + _this.streamId, error);
if (error.code === 401) {
reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.OPENVIDU_PERMISSION_DENIED, "You don't have permissions to apply a filter"));
}
else {
reject(error);
}
}
else {
console.info('Filter successfully applied on Stream ' + _this.streamId);
var oldValue = _this.filter;
_this.filter = new Filter_1.Filter(type, options);
_this.filter.stream = _this;
_this.session.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent_1.StreamPropertyChangedEvent(_this.session, _this, 'filter', _this.filter, oldValue, 'applyFilter')]);
_this.streamManager.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent_1.StreamPropertyChangedEvent(_this.streamManager, _this, 'filter', _this.filter, oldValue, 'applyFilter')]);
resolve(_this.filter);
}
});
});
};
/**
* Removes an audio/video filter previously applied.
*
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the previously applied filter has been successfully removed and rejected with an Error object in other case
*/
Stream.prototype.removeFilter = function () {
var _this = this;
return new Promise(function (resolve, reject) {
console.info('Removing filter of stream ' + _this.streamId);
_this.session.openvidu.sendRequest('removeFilter', { streamId: _this.streamId }, function (error, response) {
if (error) {
console.error('Error removing filter for Stream ' + _this.streamId, error);
if (error.code === 401) {
reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.OPENVIDU_PERMISSION_DENIED, "You don't have permissions to remove a filter"));
}
else {
reject(error);
}
}
else {
console.info('Filter successfully removed from Stream ' + _this.streamId);
var oldValue = _this.filter;
delete _this.filter;
_this.session.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent_1.StreamPropertyChangedEvent(_this.session, _this, 'filter', _this.filter, oldValue, 'applyFilter')]);
_this.streamManager.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent_1.StreamPropertyChangedEvent(_this.streamManager, _this, 'filter', _this.filter, oldValue, 'applyFilter')]);
resolve();
}
});
});
};
/* Hidden methods */
/**
* @hidden
*/
Stream.prototype.getMediaStream = function () {
return this.mediaStream;
};
/**
* @hidden
*/
Stream.prototype.setMediaStream = function (mediaStream) {
this.mediaStream = mediaStream;
};
/**
* @hidden
*/
Stream.prototype.updateMediaStreamInVideos = function () {
this.ee.emitEvent('mediastream-updated');
};
/**
* @hidden
*/
Stream.prototype.getWebRtcPeer = function () {
return this.webRtcPeer;
};
/**
* @hidden
*/
Stream.prototype.getRTCPeerConnection = function () {
return this.webRtcPeer.pc;
};
/**
* @hidden
*/
Stream.prototype.subscribeToMyRemote = function (value) {
this.isSubscribeToRemote = value;
};
/**
* @hidden
*/
Stream.prototype.setOutboundStreamOptions = function (outboundStreamOpts) {
this.outboundStreamOpts = outboundStreamOpts;
};
/**
* @hidden
*/
Stream.prototype.subscribe = function () {
var _this = this;
return new Promise(function (resolve, reject) {
_this.initWebRtcPeerReceive()
.then(function () {
resolve();
})["catch"](function (error) {
reject(error);
});
});
};
/**
* @hidden
*/
Stream.prototype.publish = function () {
var _this = this;
return new Promise(function (resolve, reject) {
if (_this.isLocalStreamReadyToPublish) {
_this.initWebRtcPeerSend()
.then(function () {
resolve();
})["catch"](function (error) {
reject(error);
});
}
else {
_this.ee.once('stream-ready-to-publish', function () {
_this.publish()
.then(function () {
resolve();
})["catch"](function (error) {
reject(error);
});
});
}
});
};
/**
* @hidden
*/
Stream.prototype.disposeWebRtcPeer = function () {
if (this.webRtcPeer) {
var isSenderAndCustomTrack = !!this.outboundStreamOpts &&
this.outboundStreamOpts.publisherProperties.videoSource instanceof MediaStreamTrack;
this.webRtcPeer.dispose(isSenderAndCustomTrack);
}
if (this.speechEvent) {
this.speechEvent.stop();
delete this.speechEvent;
}
this.stopWebRtcStats();
console.info((!!this.outboundStreamOpts ? 'Outbound ' : 'Inbound ') + "WebRTCPeer from 'Stream' with id [" + this.streamId + '] is now closed');
};
/**
* @hidden
*/
Stream.prototype.disposeMediaStream = function () {
if (this.mediaStream) {
this.mediaStream.getAudioTracks().forEach(function (track) {
track.stop();
});
this.mediaStream.getVideoTracks().forEach(function (track) {
track.stop();
});
delete this.mediaStream;
}
console.info((!!this.outboundStreamOpts ? 'Local ' : 'Remote ') + "MediaStream from 'Stream' with id [" + this.streamId + '] is now disposed');
};
/**
* @hidden
*/
Stream.prototype.displayMyRemote = function () {
return this.isSubscribeToRemote;
};
/**
* @hidden
*/
Stream.prototype.isSendAudio = function () {
return (!!this.outboundStreamOpts &&
this.outboundStreamOpts.publisherProperties.audioSource !== null &&
this.outboundStreamOpts.publisherProperties.audioSource !== false);
};
/**
* @hidden
*/
Stream.prototype.isSendVideo = function () {
return (!!this.outboundStreamOpts &&
this.outboundStreamOpts.publisherProperties.videoSource !== null &&
this.outboundStreamOpts.publisherProperties.videoSource !== false);
};
/**
* @hidden
*/
Stream.prototype.isSendScreen = function () {
return (!!this.outboundStreamOpts &&
this.outboundStreamOpts.publisherProperties.videoSource === 'screen');
};
/**
* @hidden
*/
Stream.prototype.setSpeechEventIfNotExists = function () {
if (!this.speechEvent) {
var harkOptions = this.session.openvidu.advancedConfiguration.publisherSpeakingEventsOptions || {};
harkOptions.interval = (typeof harkOptions.interval === 'number') ? harkOptions.interval : 50;
harkOptions.threshold = (typeof harkOptions.threshold === 'number') ? harkOptions.threshold : -50;
this.speechEvent = hark(this.mediaStream, harkOptions);
}
};
/**
* @hidden
*/
Stream.prototype.enableSpeakingEvents = function () {
var _this = this;
this.setSpeechEventIfNotExists();
if (!this.publisherStartSpeakingEventEnabled) {
this.publisherStartSpeakingEventEnabled = true;
this.speechEvent.on('speaking', function () {
_this.session.emitEvent('publisherStartSpeaking', [new PublisherSpeakingEvent_1.PublisherSpeakingEvent(_this.session, 'publisherStartSpeaking', _this.connection, _this.streamId)]);
});
}
if (!this.publisherStopSpeakingEventEnabled) {
this.publisherStopSpeakingEventEnabled = true;
this.speechEvent.on('stopped_speaking', function () {
_this.session.emitEvent('publisherStopSpeaking', [new PublisherSpeakingEvent_1.PublisherSpeakingEvent(_this.session, 'publisherStopSpeaking', _this.connection, _this.streamId)]);
});
}
};
/**
* @hidden
*/
Stream.prototype.enableOnceSpeakingEvents = function () {
var _this = this;
this.setSpeechEventIfNotExists();
if (!this.publisherStartSpeakingEventEnabled) {
this.publisherStartSpeakingEventEnabled = true;
this.speechEvent.once('speaking', function () {
_this.session.emitEvent('publisherStartSpeaking', [new PublisherSpeakingEvent_1.PublisherSpeakingEvent(_this.session, 'publisherStartSpeaking', _this.connection, _this.streamId)]);
_this.disableSpeakingEvents();
});
}
if (!this.publisherStopSpeakingEventEnabled) {
this.publisherStopSpeakingEventEnabled = true;
this.speechEvent.once('stopped_speaking', function () {
_this.session.emitEvent('publisherStopSpeaking', [new PublisherSpeakingEvent_1.PublisherSpeakingEvent(_this.session, 'publisherStopSpeaking', _this.connection, _this.streamId)]);
_this.disableSpeakingEvents();
});
}
};
/**
* @hidden
*/
Stream.prototype.disableSpeakingEvents = function () {
if (!!this.speechEvent) {
if (this.volumeChangeEventEnabled) {
// 'streamAudioVolumeChange' event is enabled. Cannot stop the hark process
this.speechEvent.off('speaking');
this.speechEvent.off('stopped_speaking');
}
else {
this.speechEvent.stop();
delete this.speechEvent;
}
}
this.publisherStartSpeakingEventEnabled = false;
this.publisherStopSpeakingEventEnabled = false;
};
/**
* @hidden
*/
Stream.prototype.enableVolumeChangeEvent = function () {
var _this = this;
this.setSpeechEventIfNotExists();
if (!this.volumeChangeEventEnabled) {
this.volumeChangeEventEnabled = true;
this.speechEvent.on('volume_change', function (harkEvent) {
var oldValue = _this.speechEvent.oldVolumeValue;
var value = { newValue: harkEvent, oldValue: oldValue };
_this.speechEvent.oldVolumeValue = harkEvent;
_this.streamManager.emitEvent('streamAudioVolumeChange', [new StreamManagerEvent_1.StreamManagerEvent(_this.streamManager, 'streamAudioVolumeChange', value)]);
});
}
};
/**
* @hidden
*/
Stream.prototype.enableOnceVolumeChangeEvent = function () {
var _this = this;
this.setSpeechEventIfNotExists();
if (!this.volumeChangeEventEnabled) {
this.volumeChangeEventEnabled = true;
this.speechEvent.once('volume_change', function (harkEvent) {
var oldValue = _this.speechEvent.oldVolumeValue;
var value = { newValue: harkEvent, oldValue: oldValue };
_this.speechEvent.oldVolumeValue = harkEvent;
_this.disableVolumeChangeEvent();
_this.streamManager.emitEvent('streamAudioVolumeChange', [new StreamManagerEvent_1.StreamManagerEvent(_this.streamManager, 'streamAudioVolumeChange', value)]);
});
}
};
/**
* @hidden
*/
Stream.prototype.disableVolumeChangeEvent = function () {
if (!!this.speechEvent) {
if (this.session.speakingEventsEnabled) {
// 'publisherStartSpeaking' and/or publisherStopSpeaking` events are enabled. Cannot stop the hark process
this.speechEvent.off('volume_change');
}
else {
this.speechEvent.stop();
delete this.speechEvent;
}
}
this.volumeChangeEventEnabled = false;
};
/**
* @hidden
*/
Stream.prototype.isLocal = function () {
// inbound options undefined and outbound options defined
return (!this.inboundStreamOpts && !!this.outboundStreamOpts);
};
/**
* @hidden
*/
Stream.prototype.getSelectedIceCandidate = function () {
var _this = this;
return new Promise(function (resolve, reject) {
_this.webRtcStats.getSelectedIceCandidateInfo()
.then(function (report) { return resolve(report); })["catch"](function (error) { return reject(error); });
});
};
/**
* @hidden
*/
Stream.prototype.getRemoteIceCandidateList = function () {
return this.webRtcPeer.remoteCandidatesQueue;
};
/**
* @hidden
*/
Stream.prototype.getLocalIceCandidateList = function () {
return this.webRtcPeer.localCandidatesQueue;
};
/* Private methods */
Stream.prototype.initWebRtcPeerSend = function () {
var _this = this;
return new Promise(function (resolve, reject) {
var userMediaConstraints = {
audio: _this.isSendAudio(),
video: _this.isSendVideo()
};
var options = {
mediaStream: _this.mediaStream,
mediaConstraints: userMediaConstraints,
onicecandidate: _this.connection.sendIceCandidate.bind(_this.connection),
iceServers: _this.getIceServersConf(),
simulcast: false
};
var successCallback = function (sdpOfferParam) {
console.debug('Sending SDP offer to publish as '
+ _this.streamId, sdpOfferParam);
var typeOfVideo = '';
if (_this.isSendVideo()) {
typeOfVideo = _this.outboundStreamOpts.publisherProperties.videoSource instanceof MediaStreamTrack ? 'CUSTOM' : (_this.isSendScreen() ? 'SCREEN' : 'CAMERA');
}
_this.session.openvidu.sendRequest('publishVideo', {
sdpOffer: sdpOfferParam,
doLoopback: _this.displayMyRemote() || false,
hasAudio: _this.isSendAudio(),
hasVideo: _this.isSendVideo(),
audioActive: _this.audioActive,
videoActive: _this.videoActive,
typeOfVideo: typeOfVideo,
frameRate: !!_this.frameRate ? _this.frameRate : -1,
videoDimensions: JSON.stringify(_this.videoDimensions),
filter: _this.outboundStreamOpts.publisherProperties.filter
}, function (error, response) {
if (error) {
if (error.code === 401) {
reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.OPENVIDU_PERMISSION_DENIED, "You don't have permissions to publish"));
}
else {
reject('Error on publishVideo: ' + JSON.stringify(error));
}
}
else {
_this.webRtcPeer.processAnswer(response.sdpAnswer, false)
.then(function () {
_this.streamId = response.id;
_this.isLocalStreamPublished = true;
_this.publishedOnce = true;
if (_this.displayMyRemote()) {
_this.remotePeerSuccessfullyEstablished();
}
_this.ee.emitEvent('stream-created-by-publisher');
_this.initWebRtcStats();
resolve();
})["catch"](function (error) {
reject(error);
});
console.info("'Publisher' successfully published to session");
}
});
};
if (_this.displayMyRemote()) {
_this.webRtcPeer = new WebRtcPeer_1.WebRtcPeerSendrecv(options);
}
else {
_this.webRtcPeer = new WebRtcPeer_1.WebRtcPeerSendonly(options);
}
_this.webRtcPeer.generateOffer().then(function (offer) {
successCallback(offer);
})["catch"](function (error) {
reject(new Error('(publish) SDP offer error: ' + JSON.stringify(error)));
});
});
};
Stream.prototype.initWebRtcPeerReceive = function () {
var _this = this;
return new Promise(function (resolve, reject) {
var offerConstraints = {
audio: _this.inboundStreamOpts.hasAudio,
video: _this.inboundStreamOpts.hasVideo
};
console.debug("'Session.subscribe(Stream)' called. Constraints of generate SDP offer", offerConstraints);
var options = {
onicecandidate: _this.connection.sendIceCandidate.bind(_this.connection),
mediaConstraints: offerConstraints,
iceServers: _this.getIceServersConf(),
simulcast: false
};
var successCallback = function (sdpOfferParam) {
console.debug('Sending SDP offer to subscribe to '
+ _this.streamId, sdpOfferParam);
_this.session.openvidu.sendRequest('receiveVideoFrom', {
sender: _this.streamId,
sdpOffer: sdpOfferParam
}, function (error, response) {
if (error) {
reject(new Error('Error on recvVideoFrom: ' + JSON.stringify(error)));
}
else {
// Ios Ionic. Limitation: some bug in iosrtc cordova plugin makes
// it necessary to add a timeout before processAnswer method
if (_this.session.isFirstIonicIosSubscriber) {
_this.session.isFirstIonicIosSubscriber = false;
_this.session['iosInterval'] = setTimeout(function () {
_this.session.countDownForIonicIosSubscribers = false;
}, 400);
}
var needsTimeoutOnProcessAswer = _this.session.countDownForIonicIosSubscribers;
_this.webRtcPeer.processAnswer(response.sdpAnswer, needsTimeoutOnProcessAswer).then(function () {
_this.remotePeerSuccessfullyEstablished();
_this.initWebRtcStats();
resolve();
})["catch"](function (error) {
reject(error);
});
}
});
};
_this.webRtcPeer = new WebRtcPeer_1.WebRtcPeerRecvonly(options);
_this.webRtcPeer.generateOffer()
.then(function (offer) {
successCallback(offer);
})["catch"](function (error) {
reject(new Error('(subscribe) SDP offer error: ' + JSON.stringify(error)));
});
});
};
Stream.prototype.remotePeerSuccessfullyEstablished = function () {
if (platform['isIonicIos']) {
// iOS Ionic. LIMITATION: must use deprecated WebRTC API
var pc1 = this.webRtcPeer.pc;
this.mediaStream = pc1.getRemoteStreams()[0];
}
else {
this.mediaStream = new MediaStream();
var receiver = void 0;
for (var _i = 0, _a = this.webRtcPeer.pc.getReceivers(); _i < _a.length; _i++) {
receiver = _a[_i];
if (!!receiver.track) {
this.mediaStream.addTrack(receiver.track);
}
}
}
console.debug('Peer remote stream', this.mediaStream);
if (!!this.mediaStream) {
this.ee.emitEvent('mediastream-updated');
if (!this.displayMyRemote() && !!this.mediaStream.getAudioTracks()[0] && this.session.speakingEventsEnabled) {
this.enableSpeakingEvents();
}
}
};
Stream.prototype.initWebRtcStats = function () {
this.webRtcStats = new WebRtcStats_1.WebRtcStats(this);
this.webRtcStats.initWebRtcStats();
};
Stream.prototype.stopWebRtcStats = function () {
if (!!this.webRtcStats && this.webRtcStats.isEnabled()) {
this.webRtcStats.stopWebRtcStats();
}
};
Stream.prototype.getIceServersConf = function () {
var returnValue;
if (!!this.session.openvidu.advancedConfiguration.iceServers) {
returnValue = this.session.openvidu.advancedConfiguration.iceServers === 'freeice' ?
undefined :
this.session.openvidu.advancedConfiguration.iceServers;
}
else if (this.session.openvidu.iceServers) {
returnValue = this.session.openvidu.iceServers;
}
else {
returnValue = undefined;
}
return returnValue;
};
return Stream;
}());
exports.Stream = Stream;
//# sourceMappingURL=Stream.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,129 +0,0 @@
import { Stream } from './Stream';
import { EventDispatcher } from '../OpenViduInternal/Interfaces/Public/EventDispatcher';
import { StreamManagerVideo } from '../OpenViduInternal/Interfaces/Public/StreamManagerVideo';
import { Event } from '../OpenViduInternal/Events/Event';
import { VideoInsertMode } from '../OpenViduInternal/Enums/VideoInsertMode';
import EventEmitter = require('wolfy87-eventemitter');
/**
* Interface in charge of displaying the media streams in the HTML DOM. This wraps any [[Publisher]] and [[Subscriber]] object.
* You can insert as many video players fo the same Stream as you want by calling [[StreamManager.addVideoElement]] or
* [[StreamManager.createVideoElement]].
*
* The use of StreamManager wrapper is particularly useful when you don't need to differentiate between Publisher or Subscriber streams or just
* want to directly manage your own video elements (even more than one video element per Stream). This scenario is pretty common in
* declarative, MVC frontend frameworks such as Angular, React or Vue.js
*/
export declare class StreamManager implements EventDispatcher {
/**
* The Stream represented in the DOM by the Publisher/Subscriber
*/
stream: Stream;
/**
* All the videos displaying the Stream of this Publisher/Subscriber
*/
videos: StreamManagerVideo[];
/**
* Whether the Stream represented in the DOM is local or remote
* - `false` for [[Publisher]]
* - `true` for [[Subscriber]]
*/
remote: boolean;
/**
* The DOM HTMLElement assigned as target element when creating the video for the Publisher/Subscriber. This property is only defined if:
* - [[Publisher]] has been initialized by calling method [[OpenVidu.initPublisher]] with a valid `targetElement` parameter
* - [[Subscriber]] has been initialized by calling method [[Session.subscribe]] with a valid `targetElement` parameter
*/
targetElement: HTMLElement;
/**
* `id` attribute of the DOM video element displaying the Publisher/Subscriber's stream. This property is only defined if:
* - [[Publisher]] has been initialized by calling method [[OpenVidu.initPublisher]] with a valid `targetElement` parameter
* - [[Subscriber]] has been initialized by calling method [[Session.subscribe]] with a valid `targetElement` parameter
*/
id: string;
/**
* @hidden
*/
firstVideoElement: StreamManagerVideo;
/**
* @hidden
*/
lazyLaunchVideoElementCreatedEvent: boolean;
/**
* @hidden
*/
element: HTMLElement;
/**
* @hidden
*/
protected ee: EventEmitter;
/**
* @hidden
*/
protected canPlayListener: EventListenerOrEventListenerObject;
/**
* @hidden
*/
constructor(stream: Stream, targetElement?: HTMLElement | string);
/**
* See [[EventDispatcher.on]]
*/
on(type: string, handler: (event: Event) => void): EventDispatcher;
/**
* See [[EventDispatcher.once]]
*/
once(type: string, handler: (event: Event) => void): StreamManager;
/**
* See [[EventDispatcher.off]]
*/
off(type: string, handler?: (event: Event) => void): StreamManager;
/**
* Makes `video` element parameter display this [[stream]]. This is useful when you are
* [managing the video elements on your own](/docs/how-do-i/manage-videos/#you-take-care-of-the-video-players)
*
* Calling this method with a video already added to other Publisher/Subscriber will cause the video element to be
* disassociated from that previous Publisher/Subscriber and to be associated to this one.
*
* @returns 1 if the video wasn't associated to any other Publisher/Subscriber and has been successfully added to this one.
* 0 if the video was already added to this Publisher/Subscriber. -1 if the video was previously associated to any other
* Publisher/Subscriber and has been successfully disassociated from that one and properly added to this one.
*/
addVideoElement(video: HTMLVideoElement): number;
/**
* Creates a new video element displaying this [[stream]]. This allows you to have multiple video elements displaying the same media stream.
*
* #### Events dispatched
*
* The Publisher/Subscriber object will dispatch a `videoElementCreated` event once the HTML video element has been added to DOM. See [[VideoElementEvent]]
*
* @param targetElement HTML DOM element (or its `id` attribute) in which the video element of the Publisher/Subscriber will be inserted
* @param insertMode How the video element will be inserted accordingly to `targetElemet`
*/
createVideoElement(targetElement?: string | HTMLElement, insertMode?: VideoInsertMode): HTMLVideoElement;
/**
* @hidden
*/
initializeVideoProperties(video: HTMLVideoElement): void;
/**
* @hidden
*/
removeAllVideos(): void;
/**
* @hidden
*/
disassociateVideo(video: HTMLVideoElement): boolean;
/**
* @hidden
*/
addPlayEventToFirstVideo(): void;
/**
* @hidden
*/
updateMediaStream(mediaStream: MediaStream): void;
/**
* @hidden
*/
emitEvent(type: string, eventArray: any[]): void;
private pushNewStreamManagerVideo;
private mirrorVideo;
private removeMirrorVideo;
}

View File

@ -1,398 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
var StreamManagerEvent_1 = require("../OpenViduInternal/Events/StreamManagerEvent");
var VideoElementEvent_1 = require("../OpenViduInternal/Events/VideoElementEvent");
var VideoInsertMode_1 = require("../OpenViduInternal/Enums/VideoInsertMode");
var EventEmitter = require("wolfy87-eventemitter");
var platform = require("platform");
platform['isIonicIos'] = (platform.product === 'iPhone' || platform.product === 'iPad') && platform.ua.indexOf('Safari') === -1;
/**
* Interface in charge of displaying the media streams in the HTML DOM. This wraps any [[Publisher]] and [[Subscriber]] object.
* You can insert as many video players fo the same Stream as you want by calling [[StreamManager.addVideoElement]] or
* [[StreamManager.createVideoElement]].
*
* The use of StreamManager wrapper is particularly useful when you don't need to differentiate between Publisher or Subscriber streams or just
* want to directly manage your own video elements (even more than one video element per Stream). This scenario is pretty common in
* declarative, MVC frontend frameworks such as Angular, React or Vue.js
*/
var StreamManager = /** @class */ (function () {
/**
* @hidden
*/
function StreamManager(stream, targetElement) {
var _this = this;
/**
* All the videos displaying the Stream of this Publisher/Subscriber
*/
this.videos = [];
/**
* @hidden
*/
this.lazyLaunchVideoElementCreatedEvent = false;
/**
* @hidden
*/
this.ee = new EventEmitter();
this.stream = stream;
this.stream.streamManager = this;
this.remote = !this.stream.isLocal();
if (!!targetElement) {
var targEl = void 0;
if (typeof targetElement === 'string') {
targEl = document.getElementById(targetElement);
}
else if (targetElement instanceof HTMLElement) {
targEl = targetElement;
}
if (!!targEl) {
this.firstVideoElement = {
targetElement: targEl,
video: document.createElement('video'),
id: ''
};
if (platform.name === 'Safari') {
this.firstVideoElement.video.setAttribute('playsinline', 'true');
}
this.targetElement = targEl;
this.element = targEl;
}
}
this.canPlayListener = function () {
if (_this.stream.isLocal()) {
if (!_this.stream.displayMyRemote()) {
console.info("Your local 'Stream' with id [" + _this.stream.streamId + '] video is now playing');
_this.ee.emitEvent('videoPlaying', [new VideoElementEvent_1.VideoElementEvent(_this.videos[0].video, _this, 'videoPlaying')]);
}
else {
console.info("Your own remote 'Stream' with id [" + _this.stream.streamId + '] video is now playing');
_this.ee.emitEvent('remoteVideoPlaying', [new VideoElementEvent_1.VideoElementEvent(_this.videos[0].video, _this, 'remoteVideoPlaying')]);
}
}
else {
console.info("Remote 'Stream' with id [" + _this.stream.streamId + '] video is now playing');
_this.ee.emitEvent('videoPlaying', [new VideoElementEvent_1.VideoElementEvent(_this.videos[0].video, _this, 'videoPlaying')]);
}
_this.ee.emitEvent('streamPlaying', [new StreamManagerEvent_1.StreamManagerEvent(_this, 'streamPlaying', undefined)]);
};
}
/**
* See [[EventDispatcher.on]]
*/
StreamManager.prototype.on = function (type, handler) {
var _this = this;
this.ee.on(type, function (event) {
if (event) {
console.info("Event '" + type + "' triggered by '" + (_this.remote ? 'Subscriber' : 'Publisher') + "'", event);
}
else {
console.info("Event '" + type + "' triggered by '" + (_this.remote ? 'Subscriber' : 'Publisher') + "'");
}
handler(event);
});
if (type === 'videoElementCreated') {
if (!!this.stream && this.lazyLaunchVideoElementCreatedEvent) {
this.ee.emitEvent('videoElementCreated', [new VideoElementEvent_1.VideoElementEvent(this.videos[0].video, this, 'videoElementCreated')]);
this.lazyLaunchVideoElementCreatedEvent = false;
}
}
if (type === 'streamPlaying' || type === 'videoPlaying') {
if (this.videos[0] && this.videos[0].video &&
this.videos[0].video.currentTime > 0 &&
this.videos[0].video.paused === false &&
this.videos[0].video.ended === false &&
this.videos[0].video.readyState === 4) {
this.ee.emitEvent('streamPlaying', [new StreamManagerEvent_1.StreamManagerEvent(this, 'streamPlaying', undefined)]);
this.ee.emitEvent('videoPlaying', [new VideoElementEvent_1.VideoElementEvent(this.videos[0].video, this, 'videoPlaying')]);
}
}
if (type === 'streamAudioVolumeChange' && this.stream.hasAudio) {
this.stream.enableVolumeChangeEvent();
}
return this;
};
/**
* See [[EventDispatcher.once]]
*/
StreamManager.prototype.once = function (type, handler) {
this.ee.once(type, function (event) {
if (event) {
console.info("Event '" + type + "' triggered once", event);
}
else {
console.info("Event '" + type + "' triggered once");
}
handler(event);
});
if (type === 'videoElementCreated') {
if (!!this.stream && this.lazyLaunchVideoElementCreatedEvent) {
this.ee.emitEvent('videoElementCreated', [new VideoElementEvent_1.VideoElementEvent(this.videos[0].video, this, 'videoElementCreated')]);
}
}
if (type === 'streamPlaying' || type === 'videoPlaying') {
if (this.videos[0] && this.videos[0].video &&
this.videos[0].video.currentTime > 0 &&
this.videos[0].video.paused === false &&
this.videos[0].video.ended === false &&
this.videos[0].video.readyState === 4) {
this.ee.emitEvent('streamPlaying', [new StreamManagerEvent_1.StreamManagerEvent(this, 'streamPlaying', undefined)]);
this.ee.emitEvent('videoPlaying', [new VideoElementEvent_1.VideoElementEvent(this.videos[0].video, this, 'videoPlaying')]);
}
}
if (type === 'streamAudioVolumeChange' && this.stream.hasAudio) {
this.stream.enableOnceVolumeChangeEvent();
}
return this;
};
/**
* See [[EventDispatcher.off]]
*/
StreamManager.prototype.off = function (type, handler) {
if (!handler) {
this.ee.removeAllListeners(type);
}
else {
this.ee.off(type, handler);
}
if (type === 'streamAudioVolumeChange') {
this.stream.disableVolumeChangeEvent();
}
return this;
};
/**
* Makes `video` element parameter display this [[stream]]. This is useful when you are
* [managing the video elements on your own](/docs/how-do-i/manage-videos/#you-take-care-of-the-video-players)
*
* Calling this method with a video already added to other Publisher/Subscriber will cause the video element to be
* disassociated from that previous Publisher/Subscriber and to be associated to this one.
*
* @returns 1 if the video wasn't associated to any other Publisher/Subscriber and has been successfully added to this one.
* 0 if the video was already added to this Publisher/Subscriber. -1 if the video was previously associated to any other
* Publisher/Subscriber and has been successfully disassociated from that one and properly added to this one.
*/
StreamManager.prototype.addVideoElement = function (video) {
this.initializeVideoProperties(video);
if (this.stream.isLocal() && this.stream.displayMyRemote()) {
video.srcObject = this.stream.getMediaStream();
}
// If the video element is already part of this StreamManager do nothing
for (var _i = 0, _a = this.videos; _i < _a.length; _i++) {
var v = _a[_i];
if (v.video === video) {
return 0;
}
}
var returnNumber = 1;
for (var _b = 0, _c = this.stream.session.streamManagers; _b < _c.length; _b++) {
var streamManager = _c[_b];
if (streamManager.disassociateVideo(video)) {
returnNumber = -1;
break;
}
}
this.stream.session.streamManagers.forEach(function (streamManager) {
streamManager.disassociateVideo(video);
});
this.pushNewStreamManagerVideo({
video: video,
id: video.id
});
console.info('New video element associated to ', this);
return returnNumber;
};
/**
* Creates a new video element displaying this [[stream]]. This allows you to have multiple video elements displaying the same media stream.
*
* #### Events dispatched
*
* The Publisher/Subscriber object will dispatch a `videoElementCreated` event once the HTML video element has been added to DOM. See [[VideoElementEvent]]
*
* @param targetElement HTML DOM element (or its `id` attribute) in which the video element of the Publisher/Subscriber will be inserted
* @param insertMode How the video element will be inserted accordingly to `targetElemet`
*/
StreamManager.prototype.createVideoElement = function (targetElement, insertMode) {
var targEl;
if (typeof targetElement === 'string') {
targEl = document.getElementById(targEl);
if (!targEl) {
throw new Error("The provided 'targetElement' couldn't be resolved to any HTML element: " + targetElement);
}
}
else if (targetElement instanceof HTMLElement) {
targEl = targetElement;
}
else {
throw new Error("The provided 'targetElement' couldn't be resolved to any HTML element: " + targetElement);
}
var video = document.createElement('video');
this.initializeVideoProperties(video);
var insMode = !!insertMode ? insertMode : VideoInsertMode_1.VideoInsertMode.APPEND;
switch (insMode) {
case VideoInsertMode_1.VideoInsertMode.AFTER:
targEl.parentNode.insertBefore(video, targEl.nextSibling);
break;
case VideoInsertMode_1.VideoInsertMode.APPEND:
targEl.appendChild(video);
break;
case VideoInsertMode_1.VideoInsertMode.BEFORE:
targEl.parentNode.insertBefore(video, targEl);
break;
case VideoInsertMode_1.VideoInsertMode.PREPEND:
targEl.insertBefore(video, targEl.childNodes[0]);
break;
case VideoInsertMode_1.VideoInsertMode.REPLACE:
targEl.parentNode.replaceChild(video, targEl);
break;
default:
insMode = VideoInsertMode_1.VideoInsertMode.APPEND;
targEl.appendChild(video);
break;
}
var v = {
targetElement: targEl,
video: video,
insertMode: insMode,
id: video.id
};
this.pushNewStreamManagerVideo(v);
this.ee.emitEvent('videoElementCreated', [new VideoElementEvent_1.VideoElementEvent(v.video, this, 'videoElementCreated')]);
this.lazyLaunchVideoElementCreatedEvent = !!this.firstVideoElement;
return video;
};
/**
* @hidden
*/
StreamManager.prototype.initializeVideoProperties = function (video) {
if (!(this.stream.isLocal() && this.stream.displayMyRemote())) {
// Avoid setting the MediaStream into the srcObject if remote subscription before publishing
video.srcObject = this.stream.getMediaStream();
}
video.autoplay = true;
video.controls = false;
if (platform.name === 'Safari') {
video.setAttribute('playsinline', 'true');
}
if (!video.id) {
video.id = (this.remote ? 'remote-' : 'local-') + 'video-' + this.stream.streamId;
// DEPRECATED property: assign once the property id if the user provided a valid targetElement
if (!this.id && !!this.targetElement) {
this.id = video.id;
}
}
if (!this.remote && !this.stream.displayMyRemote()) {
video.muted = true;
if (video.style.transform === 'rotateY(180deg)' && !this.stream.outboundStreamOpts.publisherProperties.mirror) {
// If the video was already rotated and now is set to not mirror
this.removeMirrorVideo(video);
}
else if (this.stream.outboundStreamOpts.publisherProperties.mirror) {
this.mirrorVideo(video);
}
}
};
/**
* @hidden
*/
StreamManager.prototype.removeAllVideos = function () {
var _this = this;
for (var i = this.stream.session.streamManagers.length - 1; i >= 0; --i) {
if (this.stream.session.streamManagers[i] === this) {
this.stream.session.streamManagers.splice(i, 1);
}
}
this.videos.forEach(function (streamManagerVideo) {
// Remove oncanplay event listener (only OpenVidu browser one, not the user ones)
streamManagerVideo.video.removeEventListener('canplay', _this.canPlayListener);
if (!!streamManagerVideo.targetElement) {
// Only remove from DOM videos created by OpenVidu Browser (those generated by passing a valid targetElement in OpenVidu.initPublisher
// and Session.subscribe or those created by StreamManager.createVideoElement). All this videos triggered a videoElementCreated event
streamManagerVideo.video.parentNode.removeChild(streamManagerVideo.video);
_this.ee.emitEvent('videoElementDestroyed', [new VideoElementEvent_1.VideoElementEvent(streamManagerVideo.video, _this, 'videoElementDestroyed')]);
}
// Remove srcObject from the video
streamManagerVideo.video.srcObject = null;
// Remove from collection of videos every video managed by OpenVidu Browser
_this.videos.filter(function (v) { return !v.targetElement; });
});
};
/**
* @hidden
*/
StreamManager.prototype.disassociateVideo = function (video) {
var disassociated = false;
for (var i = 0; i < this.videos.length; i++) {
if (this.videos[i].video === video) {
this.videos.splice(i, 1);
disassociated = true;
console.info('Video element disassociated from ', this);
break;
}
}
return disassociated;
};
/**
* @hidden
*/
StreamManager.prototype.addPlayEventToFirstVideo = function () {
if ((!!this.videos[0]) && (!!this.videos[0].video) && (this.videos[0].video.oncanplay === null)) {
this.videos[0].video.addEventListener('canplay', this.canPlayListener);
}
};
/**
* @hidden
*/
StreamManager.prototype.updateMediaStream = function (mediaStream) {
this.videos.forEach(function (streamManagerVideo) {
streamManagerVideo.video.srcObject = mediaStream;
if (platform['isIonicIos']) {
// iOS Ionic. LIMITATION: must reinsert the video in the DOM for
// the media stream to be updated
var vParent = streamManagerVideo.video.parentElement;
var newVideo = streamManagerVideo.video;
vParent.replaceChild(newVideo, streamManagerVideo.video);
streamManagerVideo.video = newVideo;
}
});
};
/**
* @hidden
*/
StreamManager.prototype.emitEvent = function (type, eventArray) {
this.ee.emitEvent(type, eventArray);
};
StreamManager.prototype.pushNewStreamManagerVideo = function (streamManagerVideo) {
this.videos.push(streamManagerVideo);
this.addPlayEventToFirstVideo();
if (this.stream.session.streamManagers.indexOf(this) === -1) {
this.stream.session.streamManagers.push(this);
}
};
StreamManager.prototype.mirrorVideo = function (video) {
if (!platform['isIonicIos']) {
video.style.transform = 'rotateY(180deg)';
video.style.webkitTransform = 'rotateY(180deg)';
}
};
StreamManager.prototype.removeMirrorVideo = function (video) {
video.style.transform = 'unset';
video.style.webkitTransform = 'unset';
};
return StreamManager;
}());
exports.StreamManager = StreamManager;
//# sourceMappingURL=StreamManager.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,23 +0,0 @@
import { Stream } from './Stream';
import { StreamManager } from './StreamManager';
import { SubscriberProperties } from '../OpenViduInternal/Interfaces/Public/SubscriberProperties';
/**
* Packs remote media streams. Participants automatically receive them when others publish their streams. Initialized with [[Session.subscribe]] method
*/
export declare class Subscriber extends StreamManager {
private properties;
/**
* @hidden
*/
constructor(stream: Stream, targEl: string | HTMLElement, properties: SubscriberProperties);
/**
* Subscribe or unsubscribe from the audio stream (if available). Calling this method twice in a row passing same value will have no effect
* @param value `true` to subscribe to the audio stream, `false` to unsubscribe from it
*/
subscribeToAudio(value: boolean): Subscriber;
/**
* Subscribe or unsubscribe from the video stream (if available). Calling this method twice in a row passing same value will have no effect
* @param value `true` to subscribe to the video stream, `false` to unsubscribe from it
*/
subscribeToVideo(value: boolean): Subscriber;
}

View File

@ -1,73 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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 __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
var StreamManager_1 = require("./StreamManager");
/**
* Packs remote media streams. Participants automatically receive them when others publish their streams. Initialized with [[Session.subscribe]] method
*/
var Subscriber = /** @class */ (function (_super) {
__extends(Subscriber, _super);
/**
* @hidden
*/
function Subscriber(stream, targEl, properties) {
var _this = _super.call(this, stream, targEl) || this;
_this.element = _this.targetElement;
_this.stream = stream;
_this.properties = properties;
return _this;
}
/**
* Subscribe or unsubscribe from the audio stream (if available). Calling this method twice in a row passing same value will have no effect
* @param value `true` to subscribe to the audio stream, `false` to unsubscribe from it
*/
Subscriber.prototype.subscribeToAudio = function (value) {
this.stream.getMediaStream().getAudioTracks().forEach(function (track) {
track.enabled = value;
});
console.info("'Subscriber' has " + (value ? 'subscribed to' : 'unsubscribed from') + ' its audio stream');
return this;
};
/**
* Subscribe or unsubscribe from the video stream (if available). Calling this method twice in a row passing same value will have no effect
* @param value `true` to subscribe to the video stream, `false` to unsubscribe from it
*/
Subscriber.prototype.subscribeToVideo = function (value) {
this.stream.getMediaStream().getVideoTracks().forEach(function (track) {
track.enabled = value;
});
console.info("'Subscriber' has " + (value ? 'subscribed to' : 'unsubscribed from') + ' its video stream');
return this;
};
return Subscriber;
}(StreamManager_1.StreamManager));
exports.Subscriber = Subscriber;
//# sourceMappingURL=Subscriber.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Subscriber.js","sourceRoot":"","sources":["../../src/OpenVidu/Subscriber.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;AAGH,iDAAgD;AAIhD;;GAEG;AACH;IAAgC,8BAAa;IAIzC;;OAEG;IACH,oBAAY,MAAc,EAAE,MAA4B,EAAE,UAAgC;QAA1F,YACI,kBAAM,MAAM,EAAE,MAAM,CAAC,SAIxB;QAHG,KAAI,CAAC,OAAO,GAAG,KAAI,CAAC,aAAa,CAAC;QAClC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,UAAU,GAAG,UAAU,CAAC;;IACjC,CAAC;IAED;;;OAGG;IACH,qCAAgB,GAAhB,UAAiB,KAAc;QAC3B,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,cAAc,EAAE,CAAC,OAAO,CAAC,UAAC,KAAK;YACxD,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;QAC1B,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,mBAAmB,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC,CAAC;QAC1G,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;OAGG;IACH,qCAAgB,GAAhB,UAAiB,KAAc;QAC3B,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,cAAc,EAAE,CAAC,OAAO,CAAC,UAAC,KAAK;YACxD,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;QAC1B,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,mBAAmB,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC,CAAC;QAC1G,OAAO,IAAI,CAAC;IAChB,CAAC;IAEL,iBAAC;AAAD,CAAC,AAtCD,CAAgC,6BAAa,GAsC5C;AAtCY,gCAAU"}

View File

@ -1,6 +0,0 @@
export declare enum LocalRecorderState {
READY = "READY",
RECORDING = "RECORDING",
PAUSED = "PAUSED",
FINISHED = "FINISHED"
}

View File

@ -1,26 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
var LocalRecorderState;
(function (LocalRecorderState) {
LocalRecorderState["READY"] = "READY";
LocalRecorderState["RECORDING"] = "RECORDING";
LocalRecorderState["PAUSED"] = "PAUSED";
LocalRecorderState["FINISHED"] = "FINISHED";
})(LocalRecorderState = exports.LocalRecorderState || (exports.LocalRecorderState = {}));
//# sourceMappingURL=LocalRecorderState.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"LocalRecorderState.js","sourceRoot":"","sources":["../../../src/OpenViduInternal/Enums/LocalRecorderState.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAEH,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC1B,qCAAe,CAAA;IACf,6CAAuB,CAAA;IACvB,uCAAiB,CAAA;IACjB,2CAAqB,CAAA;AACzB,CAAC,EALW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAK7B"}

View File

@ -1,80 +0,0 @@
/**
* Defines property [[OpenViduError.name]]
*/
export declare enum OpenViduErrorName {
/**
* Browser is not supported by OpenVidu.
* Returned upon unsuccessful [[Session.connect]]
*/
BROWSER_NOT_SUPPORTED = "BROWSER_NOT_SUPPORTED",
/**
* The user hasn't granted permissions to the required input device when the browser asked for them.
* Returned upon unsuccessful [[OpenVidu.initPublisher]] or [[OpenVidu.getUserMedia]]
*/
DEVICE_ACCESS_DENIED = "DEVICE_ACCESS_DENIED",
/**
* The user hasn't granted permissions to capture some desktop screen when the browser asked for them.
* Returned upon unsuccessful [[OpenVidu.initPublisher]] or [[OpenVidu.getUserMedia]]
*/
SCREEN_CAPTURE_DENIED = "SCREEN_CAPTURE_DENIED",
/**
* Browser does not support screen sharing.
* Returned upon unsuccessful [[OpenVidu.initPublisher]]
*/
SCREEN_SHARING_NOT_SUPPORTED = "SCREEN_SHARING_NOT_SUPPORTED",
/**
* Only for Chrome, there's no screen sharing extension installed
* Returned upon unsuccessful [[OpenVidu.initPublisher]]
*/
SCREEN_EXTENSION_NOT_INSTALLED = "SCREEN_EXTENSION_NOT_INSTALLED",
/**
* Only for Chrome, the screen sharing extension is installed but is disabled
* Returned upon unsuccessful [[OpenVidu.initPublisher]]
*/
SCREEN_EXTENSION_DISABLED = "SCREEN_EXTENSION_DISABLED",
/**
* No video input device found with the provided deviceId (property [[PublisherProperties.videoSource]])
* Returned upon unsuccessful [[OpenVidu.initPublisher]]
*/
INPUT_VIDEO_DEVICE_NOT_FOUND = "INPUT_VIDEO_DEVICE_NOT_FOUND",
/**
* No audio input device found with the provided deviceId (property [[PublisherProperties.audioSource]])
* Returned upon unsuccessful [[OpenVidu.initPublisher]]
*/
INPUT_AUDIO_DEVICE_NOT_FOUND = "INPUT_AUDIO_DEVICE_NOT_FOUND",
/**
* Method [[OpenVidu.initPublisher]] has been called with properties `videoSource` and `audioSource` of
* [[PublisherProperties]] parameter both set to *false* or *null*
*/
NO_INPUT_SOURCE_SET = "NO_INPUT_SOURCE_SET",
/**
* Some media property of [[PublisherProperties]] such as `frameRate` or `resolution` is not supported
* by the input devices (whenever it is possible they are automatically adjusted to the most similar value).
* Returned upon unsuccessful [[OpenVidu.initPublisher]]
*/
PUBLISHER_PROPERTIES_ERROR = "PUBLISHER_PROPERTIES_ERROR",
/**
* The client tried to call a method without the required permissions. This can occur for methods [[Session.publish]],
* [[Session.forceUnpublish]], [[Session.forceDisconnect]], [[Stream.applyFilter]], [[Stream.removeFilter]]
*/
OPENVIDU_PERMISSION_DENIED = "OPENVIDU_PERMISSION_DENIED",
/**
* _Not in use yet_
*/
OPENVIDU_NOT_CONNECTED = "OPENVIDU_NOT_CONNECTED",
/**
* _Not in use yet_
*/
GENERIC_ERROR = "GENERIC_ERROR"
}
/**
* Simple object to identify runtime errors on the client side
*/
export declare class OpenViduError {
name: OpenViduErrorName;
message: string;
/**
* @hidden
*/
constructor(name: OpenViduErrorName, message: string);
}

View File

@ -1,103 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
/**
* Defines property [[OpenViduError.name]]
*/
var OpenViduErrorName;
(function (OpenViduErrorName) {
/**
* Browser is not supported by OpenVidu.
* Returned upon unsuccessful [[Session.connect]]
*/
OpenViduErrorName["BROWSER_NOT_SUPPORTED"] = "BROWSER_NOT_SUPPORTED";
/**
* The user hasn't granted permissions to the required input device when the browser asked for them.
* Returned upon unsuccessful [[OpenVidu.initPublisher]] or [[OpenVidu.getUserMedia]]
*/
OpenViduErrorName["DEVICE_ACCESS_DENIED"] = "DEVICE_ACCESS_DENIED";
/**
* The user hasn't granted permissions to capture some desktop screen when the browser asked for them.
* Returned upon unsuccessful [[OpenVidu.initPublisher]] or [[OpenVidu.getUserMedia]]
*/
OpenViduErrorName["SCREEN_CAPTURE_DENIED"] = "SCREEN_CAPTURE_DENIED";
/**
* Browser does not support screen sharing.
* Returned upon unsuccessful [[OpenVidu.initPublisher]]
*/
OpenViduErrorName["SCREEN_SHARING_NOT_SUPPORTED"] = "SCREEN_SHARING_NOT_SUPPORTED";
/**
* Only for Chrome, there's no screen sharing extension installed
* Returned upon unsuccessful [[OpenVidu.initPublisher]]
*/
OpenViduErrorName["SCREEN_EXTENSION_NOT_INSTALLED"] = "SCREEN_EXTENSION_NOT_INSTALLED";
/**
* Only for Chrome, the screen sharing extension is installed but is disabled
* Returned upon unsuccessful [[OpenVidu.initPublisher]]
*/
OpenViduErrorName["SCREEN_EXTENSION_DISABLED"] = "SCREEN_EXTENSION_DISABLED";
/**
* No video input device found with the provided deviceId (property [[PublisherProperties.videoSource]])
* Returned upon unsuccessful [[OpenVidu.initPublisher]]
*/
OpenViduErrorName["INPUT_VIDEO_DEVICE_NOT_FOUND"] = "INPUT_VIDEO_DEVICE_NOT_FOUND";
/**
* No audio input device found with the provided deviceId (property [[PublisherProperties.audioSource]])
* Returned upon unsuccessful [[OpenVidu.initPublisher]]
*/
OpenViduErrorName["INPUT_AUDIO_DEVICE_NOT_FOUND"] = "INPUT_AUDIO_DEVICE_NOT_FOUND";
/**
* Method [[OpenVidu.initPublisher]] has been called with properties `videoSource` and `audioSource` of
* [[PublisherProperties]] parameter both set to *false* or *null*
*/
OpenViduErrorName["NO_INPUT_SOURCE_SET"] = "NO_INPUT_SOURCE_SET";
/**
* Some media property of [[PublisherProperties]] such as `frameRate` or `resolution` is not supported
* by the input devices (whenever it is possible they are automatically adjusted to the most similar value).
* Returned upon unsuccessful [[OpenVidu.initPublisher]]
*/
OpenViduErrorName["PUBLISHER_PROPERTIES_ERROR"] = "PUBLISHER_PROPERTIES_ERROR";
/**
* The client tried to call a method without the required permissions. This can occur for methods [[Session.publish]],
* [[Session.forceUnpublish]], [[Session.forceDisconnect]], [[Stream.applyFilter]], [[Stream.removeFilter]]
*/
OpenViduErrorName["OPENVIDU_PERMISSION_DENIED"] = "OPENVIDU_PERMISSION_DENIED";
/**
* _Not in use yet_
*/
OpenViduErrorName["OPENVIDU_NOT_CONNECTED"] = "OPENVIDU_NOT_CONNECTED";
/**
* _Not in use yet_
*/
OpenViduErrorName["GENERIC_ERROR"] = "GENERIC_ERROR";
})(OpenViduErrorName = exports.OpenViduErrorName || (exports.OpenViduErrorName = {}));
/**
* Simple object to identify runtime errors on the client side
*/
var OpenViduError = /** @class */ (function () {
/**
* @hidden
*/
function OpenViduError(name, message) {
this.name = name;
this.message = message;
}
return OpenViduError;
}());
exports.OpenViduError = OpenViduError;
//# sourceMappingURL=OpenViduError.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"OpenViduError.js","sourceRoot":"","sources":["../../../src/OpenViduInternal/Enums/OpenViduError.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAEH;;GAEG;AACH,IAAY,iBA8EX;AA9ED,WAAY,iBAAiB;IAEzB;;;OAGG;IACH,oEAA+C,CAAA;IAE/C;;;OAGG;IACH,kEAA6C,CAAA;IAE7C;;;OAGG;IACH,oEAA+C,CAAA;IAE/C;;;OAGG;IACH,kFAA6D,CAAA;IAE7D;;;OAGG;IACH,sFAAiE,CAAA;IAEjE;;;OAGG;IACH,4EAAuD,CAAA;IAEvD;;;OAGG;IACH,kFAA6D,CAAA;IAE7D;;;OAGG;IACH,kFAA6D,CAAA;IAE7D;;;OAGG;IACH,gEAA2C,CAAA;IAE3C;;;;OAIG;IACH,8EAAyD,CAAA;IAEzD;;;OAGG;IACH,8EAAyD,CAAA;IAEzD;;OAEG;IACH,sEAAiD,CAAA;IAEjD;;OAEG;IACH,oDAA+B,CAAA;AACnC,CAAC,EA9EW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QA8E5B;AAED;;GAEG;AACH;IAKI;;OAEG;IACH,uBAAY,IAAuB,EAAE,OAAe;QAChD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAEL,oBAAC;AAAD,CAAC,AAbD,IAaC;AAbY,sCAAa"}

View File

@ -1,25 +0,0 @@
/**
* How the video will be inserted in the DOM for Publishers and Subscribers. See [[PublisherProperties.insertMode]] and [[SubscriberProperties.insertMode]]
*/
export declare enum VideoInsertMode {
/**
* Video inserted after the target element (as next sibling)
*/
AFTER = "AFTER",
/**
* Video inserted as last child of the target element
*/
APPEND = "APPEND",
/**
* Video inserted before the target element (as previous sibling)
*/
BEFORE = "BEFORE",
/**
* Video inserted as first child of the target element
*/
PREPEND = "PREPEND",
/**
* Video replaces target element
*/
REPLACE = "REPLACE"
}

View File

@ -1,45 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
/**
* How the video will be inserted in the DOM for Publishers and Subscribers. See [[PublisherProperties.insertMode]] and [[SubscriberProperties.insertMode]]
*/
var VideoInsertMode;
(function (VideoInsertMode) {
/**
* Video inserted after the target element (as next sibling)
*/
VideoInsertMode["AFTER"] = "AFTER";
/**
* Video inserted as last child of the target element
*/
VideoInsertMode["APPEND"] = "APPEND";
/**
* Video inserted before the target element (as previous sibling)
*/
VideoInsertMode["BEFORE"] = "BEFORE";
/**
* Video inserted as first child of the target element
*/
VideoInsertMode["PREPEND"] = "PREPEND";
/**
* Video replaces target element
*/
VideoInsertMode["REPLACE"] = "REPLACE";
})(VideoInsertMode = exports.VideoInsertMode || (exports.VideoInsertMode = {}));
//# sourceMappingURL=VideoInsertMode.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"VideoInsertMode.js","sourceRoot":"","sources":["../../../src/OpenViduInternal/Enums/VideoInsertMode.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAEH;;GAEG;AACH,IAAY,eAuBX;AAvBD,WAAY,eAAe;IAEvB;;OAEG;IACH,kCAAe,CAAA;IACf;;OAEG;IACH,oCAAiB,CAAA;IACjB;;OAEG;IACH,oCAAiB,CAAA;IACjB;;OAEG;IACH,sCAAmB,CAAA;IACnB;;OAEG;IACH,sCAAmB,CAAA;AAEvB,CAAC,EAvBW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAuB1B"}

View File

@ -1,33 +0,0 @@
import { Event } from './Event';
import { Connection } from '../../OpenVidu/Connection';
import { Session } from '../../OpenVidu/Session';
/**
* Defines the following events:
* - `connectionCreated`: dispatched by [[Session]]
* - `connectionDestroyed`: dispatched by [[Session]]
*/
export declare class ConnectionEvent extends Event {
/**
* Connection object that was created or destroyed
*/
connection: Connection;
/**
* For `connectionDestroyed` event:
* - "disconnect": the remote user has called `Session.disconnect()`
* - "forceDisconnectByUser": the remote user has been evicted from the Session by other user calling `Session.forceDisconnect()`
* - "forceDisconnectByServer": the remote user has been evicted from the Session by the application
* - "sessionClosedByServer": the Session has been closed by the application
* - "networkDisconnect": the remote user network connection has dropped
*
* For `connectionCreated` event an empty string
*/
reason: string;
/**
* @hidden
*/
constructor(cancelable: boolean, target: Session, type: string, connection: Connection, reason: string);
/**
* @hidden
*/
callDefaultBehavior(): void;
}

View File

@ -1,57 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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 __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
var Event_1 = require("./Event");
/**
* Defines the following events:
* - `connectionCreated`: dispatched by [[Session]]
* - `connectionDestroyed`: dispatched by [[Session]]
*/
var ConnectionEvent = /** @class */ (function (_super) {
__extends(ConnectionEvent, _super);
/**
* @hidden
*/
function ConnectionEvent(cancelable, target, type, connection, reason) {
var _this = _super.call(this, cancelable, target, type) || this;
_this.connection = connection;
_this.reason = reason;
return _this;
}
/**
* @hidden
*/
// tslint:disable-next-line:no-empty
ConnectionEvent.prototype.callDefaultBehavior = function () { };
return ConnectionEvent;
}(Event_1.Event));
exports.ConnectionEvent = ConnectionEvent;
//# sourceMappingURL=ConnectionEvent.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"ConnectionEvent.js","sourceRoot":"","sources":["../../../src/OpenViduInternal/Events/ConnectionEvent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;AAEH,iCAAgC;AAKhC;;;;GAIG;AACH;IAAqC,mCAAK;IAmBtC;;OAEG;IACH,yBAAY,UAAmB,EAAE,MAAe,EAAE,IAAY,EAAE,UAAsB,EAAE,MAAc;QAAtG,YACI,kBAAM,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,SAGlC;QAFG,KAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACzB,CAAC;IAED;;OAEG;IACH,oCAAoC;IACpC,6CAAmB,GAAnB,cAAwB,CAAC;IAE7B,sBAAC;AAAD,CAAC,AAlCD,CAAqC,aAAK,GAkCzC;AAlCY,0CAAe"}

View File

@ -1,42 +0,0 @@
import { Filter } from '../../OpenVidu/Filter';
import { StreamManager } from '../../OpenVidu/StreamManager';
import { Session } from '../../OpenVidu/Session';
export declare abstract class Event {
/**
* Whether the event has a default behavior that may be prevented by calling [[Event.preventDefault]]
*/
cancelable: boolean;
/**
* The object that dispatched the event
*/
target: Session | StreamManager | Filter;
/**
* The type of event. This is the same string you pass as first parameter when calling method `on()` of any object implementing [[EventDispatcher]] interface
*/
type: string;
private hasBeenPrevented;
/**
* @hidden
*/
constructor(cancelable: boolean, target: Session | StreamManager | Filter, type: string);
/**
* Whether the default beahivour of the event has been prevented or not. Call [[Event.preventDefault]] to prevent it
*/
isDefaultPrevented(): boolean;
/**
* Prevents the default behavior of the event. The following events have a default behavior:
*
* - `sessionDisconnected`: dispatched by [[Session]] object, automatically unsubscribes the leaving participant from every Subscriber object of the session (this includes closing the WebRTCPeer connection and disposing all MediaStreamTracks)
* and also deletes any HTML video element associated to each Subscriber (only those created by OpenVidu Browser, either by passing a valid parameter as `targetElement` in method [[Session.subscribe]] or
* by calling [[Subscriber.createVideoElement]]). For every video removed, each Subscriber object will also dispatch a `videoElementDestroyed` event.
*
* - `streamDestroyed`:
* - If dispatched by a [[Publisher]] (*you* have unpublished): automatically stops all media tracks and deletes any HTML video element associated to it (only those created by OpenVidu Browser, either by passing a valid parameter as `targetElement`
* in method [[OpenVidu.initPublisher]] or by calling [[Publisher.createVideoElement]]). For every video removed, the Publisher object will also dispatch a `videoElementDestroyed` event.
* - If dispatched by [[Session]] (*other user* has unpublished): automatically unsubscribes the proper Subscriber object from the session (this includes closing the WebRTCPeer connection and disposing all MediaStreamTracks)
* and also deletes any HTML video element associated to that Subscriber (only those created by OpenVidu Browser, either by passing a valid parameter as `targetElement` in method [[Session.subscribe]] or
* by calling [[Subscriber.createVideoElement]]). For every video removed, the Subscriber object will also dispatch a `videoElementDestroyed` event.
*/
preventDefault(): void;
protected abstract callDefaultBehavior(): any;
}

View File

@ -1,57 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
var Event = /** @class */ (function () {
/**
* @hidden
*/
function Event(cancelable, target, type) {
this.hasBeenPrevented = false;
this.cancelable = cancelable;
this.target = target;
this.type = type;
}
/**
* Whether the default beahivour of the event has been prevented or not. Call [[Event.preventDefault]] to prevent it
*/
Event.prototype.isDefaultPrevented = function () {
return this.hasBeenPrevented;
};
/**
* Prevents the default behavior of the event. The following events have a default behavior:
*
* - `sessionDisconnected`: dispatched by [[Session]] object, automatically unsubscribes the leaving participant from every Subscriber object of the session (this includes closing the WebRTCPeer connection and disposing all MediaStreamTracks)
* and also deletes any HTML video element associated to each Subscriber (only those created by OpenVidu Browser, either by passing a valid parameter as `targetElement` in method [[Session.subscribe]] or
* by calling [[Subscriber.createVideoElement]]). For every video removed, each Subscriber object will also dispatch a `videoElementDestroyed` event.
*
* - `streamDestroyed`:
* - If dispatched by a [[Publisher]] (*you* have unpublished): automatically stops all media tracks and deletes any HTML video element associated to it (only those created by OpenVidu Browser, either by passing a valid parameter as `targetElement`
* in method [[OpenVidu.initPublisher]] or by calling [[Publisher.createVideoElement]]). For every video removed, the Publisher object will also dispatch a `videoElementDestroyed` event.
* - If dispatched by [[Session]] (*other user* has unpublished): automatically unsubscribes the proper Subscriber object from the session (this includes closing the WebRTCPeer connection and disposing all MediaStreamTracks)
* and also deletes any HTML video element associated to that Subscriber (only those created by OpenVidu Browser, either by passing a valid parameter as `targetElement` in method [[Session.subscribe]] or
* by calling [[Subscriber.createVideoElement]]). For every video removed, the Subscriber object will also dispatch a `videoElementDestroyed` event.
*/
Event.prototype.preventDefault = function () {
// tslint:disable-next-line:no-empty
this.callDefaultBehavior = function () { };
this.hasBeenPrevented = true;
};
return Event;
}());
exports.Event = Event;
//# sourceMappingURL=Event.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Event.js","sourceRoot":"","sources":["../../../src/OpenViduInternal/Events/Event.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAOH;IAmBI;;OAEG;IACH,eAAY,UAAmB,EAAE,MAAwC,EAAE,IAAY;QAL/E,qBAAgB,GAAG,KAAK,CAAC;QAM7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,kCAAkB,GAAlB;QACI,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,8BAAc,GAAd;QACI,oCAAoC;QACpC,IAAI,CAAC,mBAAmB,GAAG,cAAQ,CAAC,CAAC;QACrC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IACjC,CAAC;IAIL,YAAC;AAAD,CAAC,AAzDD,IAyDC;AAzDqB,sBAAK"}

View File

@ -1,19 +0,0 @@
import { Event } from './Event';
import { Filter } from '../../OpenVidu/Filter';
/**
* Defines every event dispatched by audio/video stream filters. You can subscribe to filter events by calling [[Filter.addEventListener]]
*/
export declare class FilterEvent extends Event {
/**
* Data of the event
*/
data: Object;
/**
* @hidden
*/
constructor(target: Filter, eventType: string, data: Object);
/**
* @hidden
*/
callDefaultBehavior(): void;
}

View File

@ -1,54 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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 __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
var Event_1 = require("./Event");
/**
* Defines every event dispatched by audio/video stream filters. You can subscribe to filter events by calling [[Filter.addEventListener]]
*/
var FilterEvent = /** @class */ (function (_super) {
__extends(FilterEvent, _super);
/**
* @hidden
*/
function FilterEvent(target, eventType, data) {
var _this = _super.call(this, false, target, eventType) || this;
_this.data = data;
return _this;
}
/**
* @hidden
*/
// tslint:disable-next-line:no-empty
FilterEvent.prototype.callDefaultBehavior = function () { };
return FilterEvent;
}(Event_1.Event));
exports.FilterEvent = FilterEvent;
//# sourceMappingURL=FilterEvent.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"FilterEvent.js","sourceRoot":"","sources":["../../../src/OpenViduInternal/Events/FilterEvent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;AAEH,iCAAgC;AAKhC;;GAEG;AACH;IAAiC,+BAAK;IAOlC;;OAEG;IACH,qBAAY,MAAc,EAAE,SAAiB,EAAE,IAAY;QAA3D,YACI,kBAAM,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,SAElC;QADG,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;;IACrB,CAAC;IAED;;OAEG;IACH,oCAAoC;IACpC,yCAAmB,GAAnB,cAAwB,CAAC;IAE7B,kBAAC;AAAD,CAAC,AArBD,CAAiC,aAAK,GAqBrC;AArBY,kCAAW"}

View File

@ -1,32 +0,0 @@
import { Event } from './Event';
import { Connection } from '../../OpenVidu/Connection';
import { Session } from '../..';
/**
* Defines the following events:
* - `publisherStartSpeaking`: dispatched by [[Session]]
* - `publisherStopSpeaking`: dispatched by [[Session]]
*
* More information:
* - This events will only be triggered for **remote streams that have audio tracks** ([[Stream.hasAudio]] must be true)
* - Both events share the same lifecycle. That means that you can subscribe to only one of them if you want, but if you call `Session.off('publisherStopSpeaking')`,
* keep in mind that this will also internally remove any 'publisherStartSpeaking' event
* - You can further configure how the events are dispatched by setting property `publisherSpeakingEventsOptions` in the call of [[OpenVidu.setAdvancedConfiguration]]
*/
export declare class PublisherSpeakingEvent extends Event {
/**
* The client that started or stopped speaking
*/
connection: Connection;
/**
* The streamId of the Stream affected by the speaking event
*/
streamId: string;
/**
* @hidden
*/
constructor(target: Session, type: string, connection: Connection, streamId: string);
/**
* @hidden
*/
callDefaultBehavior(): void;
}

View File

@ -1,64 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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 __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
var Event_1 = require("./Event");
/**
* Defines the following events:
* - `publisherStartSpeaking`: dispatched by [[Session]]
* - `publisherStopSpeaking`: dispatched by [[Session]]
*
* More information:
* - This events will only be triggered for **remote streams that have audio tracks** ([[Stream.hasAudio]] must be true)
* - Both events share the same lifecycle. That means that you can subscribe to only one of them if you want, but if you call `Session.off('publisherStopSpeaking')`,
* keep in mind that this will also internally remove any 'publisherStartSpeaking' event
* - You can further configure how the events are dispatched by setting property `publisherSpeakingEventsOptions` in the call of [[OpenVidu.setAdvancedConfiguration]]
*/
var PublisherSpeakingEvent = /** @class */ (function (_super) {
__extends(PublisherSpeakingEvent, _super);
/**
* @hidden
*/
function PublisherSpeakingEvent(target, type, connection, streamId) {
var _this = _super.call(this, false, target, type) || this;
_this.type = type;
_this.connection = connection;
_this.streamId = streamId;
return _this;
}
/**
* @hidden
*/
// tslint:disable-next-line:no-empty
PublisherSpeakingEvent.prototype.callDefaultBehavior = function () { };
return PublisherSpeakingEvent;
}(Event_1.Event));
exports.PublisherSpeakingEvent = PublisherSpeakingEvent;
//# sourceMappingURL=PublisherSpeakingEvent.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"PublisherSpeakingEvent.js","sourceRoot":"","sources":["../../../src/OpenViduInternal/Events/PublisherSpeakingEvent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;AAEH,iCAAgC;AAKhC;;;;;;;;;;GAUG;AACH;IAA4C,0CAAK;IAY7C;;OAEG;IACH,gCAAY,MAAe,EAAE,IAAY,EAAE,UAAsB,EAAE,QAAgB;QAAnF,YACI,kBAAM,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,SAI7B;QAHG,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;;IAC7B,CAAC;IAED;;OAEG;IACH,oCAAoC;IACpC,oDAAmB,GAAnB,cAAwB,CAAC;IAE7B,6BAAC;AAAD,CAAC,AA5BD,CAA4C,aAAK,GA4BhD;AA5BY,wDAAsB"}

View File

@ -1,30 +0,0 @@
import { Event } from './Event';
import { Session } from '../../OpenVidu/Session';
/**
* Defines the following events:
* - `recordingStarted`: dispatched by [[Session]]
* - `recordingStopped`: dispatched by [[Session]]
*/
export declare class RecordingEvent extends Event {
/**
* The recording ID generated in openvidu-server
*/
id: string;
/**
* The recording name you supplied to openvidu-server. For example, to name your recording file MY_RECORDING:
* - With **API REST**: POST to `/api/recordings/start` passing JSON body `{"session":"sessionId","name":"MY_RECORDING"}`
* - With **openvidu-java-client**: `OpenVidu.startRecording(sessionId, "MY_RECORDING")` or `OpenVidu.startRecording(sessionId, new RecordingProperties.Builder().name("MY_RECORDING").build())`
* - With **openvidu-node-client**: `OpenVidu.startRecording(sessionId, "MY_RECORDING")` or `OpenVidu.startRecording(sessionId, {name: "MY_RECORDING"})`
*
* If no name is supplied, this property will be undefined and the recorded file will be named after property [[id]]
*/
name?: string;
/**
* @hidden
*/
constructor(target: Session, type: string, id: string, name: string);
/**
* @hidden
*/
callDefaultBehavior(): void;
}

View File

@ -1,59 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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 __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
var Event_1 = require("./Event");
/**
* Defines the following events:
* - `recordingStarted`: dispatched by [[Session]]
* - `recordingStopped`: dispatched by [[Session]]
*/
var RecordingEvent = /** @class */ (function (_super) {
__extends(RecordingEvent, _super);
/**
* @hidden
*/
function RecordingEvent(target, type, id, name) {
var _this = _super.call(this, false, target, type) || this;
_this.id = id;
if (name !== id) {
_this.name = name;
}
return _this;
}
/**
* @hidden
*/
// tslint:disable-next-line:no-empty
RecordingEvent.prototype.callDefaultBehavior = function () { };
return RecordingEvent;
}(Event_1.Event));
exports.RecordingEvent = RecordingEvent;
//# sourceMappingURL=RecordingEvent.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"RecordingEvent.js","sourceRoot":"","sources":["../../../src/OpenViduInternal/Events/RecordingEvent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;AAEH,iCAAgC;AAIhC;;;;GAIG;AACH;IAAoC,kCAAK;IAiBrC;;OAEG;IACH,wBAAY,MAAe,EAAE,IAAY,EAAE,EAAU,EAAE,IAAY;QAAnE,YACI,kBAAM,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,SAK7B;QAJG,KAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,IAAI,KAAK,EAAE,EAAE;YACb,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;SACpB;;IACL,CAAC;IAED;;OAEG;IACH,oCAAoC;IACpC,4CAAmB,GAAnB,cAAwB,CAAC;IAE7B,qBAAC;AAAD,CAAC,AAlCD,CAAoC,aAAK,GAkCxC;AAlCY,wCAAc"}

View File

@ -1,23 +0,0 @@
import { Event } from './Event';
import { Session } from '../../OpenVidu/Session';
/**
* Defines event `sessionDisconnected` dispatched by [[Session]]
*/
export declare class SessionDisconnectedEvent extends Event {
/**
* - "disconnect": you have called `Session.disconnect()`
* - "forceDisconnectByUser": you have been evicted from the Session by other user calling `Session.forceDisconnect()`
* - "forceDisconnectByServer": you have been evicted from the Session by the application
* - "sessionClosedByServer": the Session has been closed by the application
* - "networkDisconnect": your network connection has dropped
*/
reason: string;
/**
* @hidden
*/
constructor(target: Session, reason: string);
/**
* @hidden
*/
callDefaultBehavior(): void;
}

View File

@ -1,69 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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 __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
var Event_1 = require("./Event");
/**
* Defines event `sessionDisconnected` dispatched by [[Session]]
*/
var SessionDisconnectedEvent = /** @class */ (function (_super) {
__extends(SessionDisconnectedEvent, _super);
/**
* @hidden
*/
function SessionDisconnectedEvent(target, reason) {
var _this = _super.call(this, true, target, 'sessionDisconnected') || this;
_this.reason = reason;
return _this;
}
/**
* @hidden
*/
SessionDisconnectedEvent.prototype.callDefaultBehavior = function () {
console.info("Calling default behavior upon '" + this.type + "' event dispatched by 'Session'");
var session = this.target;
// Dispose and delete all remote Connections
for (var connectionId in session.remoteConnections) {
if (!!session.remoteConnections[connectionId].stream) {
session.remoteConnections[connectionId].stream.disposeWebRtcPeer();
session.remoteConnections[connectionId].stream.disposeMediaStream();
if (session.remoteConnections[connectionId].stream.streamManager) {
session.remoteConnections[connectionId].stream.streamManager.removeAllVideos();
}
delete session.remoteStreamsCreated[session.remoteConnections[connectionId].stream.streamId];
session.remoteConnections[connectionId].dispose();
}
delete session.remoteConnections[connectionId];
}
};
return SessionDisconnectedEvent;
}(Event_1.Event));
exports.SessionDisconnectedEvent = SessionDisconnectedEvent;
//# sourceMappingURL=SessionDisconnectedEvent.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"SessionDisconnectedEvent.js","sourceRoot":"","sources":["../../../src/OpenViduInternal/Events/SessionDisconnectedEvent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;AAEH,iCAAgC;AAIhC;;GAEG;AACH;IAA8C,4CAAK;IAW/C;;OAEG;IACH,kCAAY,MAAe,EAAE,MAAc;QAA3C,YACI,kBAAM,IAAI,EAAE,MAAM,EAAE,qBAAqB,CAAC,SAE7C;QADG,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACzB,CAAC;IAED;;OAEG;IACH,sDAAmB,GAAnB;QAEI,OAAO,CAAC,IAAI,CAAC,iCAAiC,GAAG,IAAI,CAAC,IAAI,GAAG,iCAAiC,CAAC,CAAC;QAEhG,IAAM,OAAO,GAAY,IAAI,CAAC,MAAM,CAAC;QAErC,4CAA4C;QAC5C,KAAK,IAAM,YAAY,IAAI,OAAO,CAAC,iBAAiB,EAAE;YAClD,IAAI,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,MAAM,EAAE;gBAClD,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;gBACnE,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC;gBACpE,IAAI,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,aAAa,EAAE;oBAC9D,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,eAAe,EAAE,CAAC;iBAClF;gBACD,OAAO,OAAO,CAAC,oBAAoB,CAAC,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBAC7F,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC;aACrD;YACD,OAAO,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;SAClD;IACL,CAAC;IAEL,+BAAC;AAAD,CAAC,AA3CD,CAA8C,aAAK,GA2ClD;AA3CY,4DAAwB"}

View File

@ -1,34 +0,0 @@
import { Event } from './Event';
import { Connection } from '../../OpenVidu/Connection';
import { Session } from '../../OpenVidu/Session';
/**
* Defines the following events:
* - `signal`: dispatched by [[Session]]
* - `signal:TYPE`: dispatched by [[Session]]
*/
export declare class SignalEvent extends Event {
/**
* The type of signal (can be empty).
*
* The client must be subscribed to `Session.on('signal:type', function(signalEvent) {...})` to receive this object in the callback.
*
* Subscribing to `Session.on('signal', function(signalEvent) {...})` will trigger all types of signals.
*/
type: string;
/**
* The message of the signal (can be emtpy)
*/
data: string;
/**
* The client that sent the signal
*/
from: Connection;
/**
* @hidden
*/
constructor(target: Session, type: string, data: string, from: Connection);
/**
* @hidden
*/
callDefaultBehavior(): void;
}

View File

@ -1,58 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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 __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
var Event_1 = require("./Event");
/**
* Defines the following events:
* - `signal`: dispatched by [[Session]]
* - `signal:TYPE`: dispatched by [[Session]]
*/
var SignalEvent = /** @class */ (function (_super) {
__extends(SignalEvent, _super);
/**
* @hidden
*/
function SignalEvent(target, type, data, from) {
var _this = _super.call(this, false, target, type) || this;
_this.type = type;
_this.data = data;
_this.from = from;
return _this;
}
/**
* @hidden
*/
// tslint:disable-next-line:no-empty
SignalEvent.prototype.callDefaultBehavior = function () { };
return SignalEvent;
}(Event_1.Event));
exports.SignalEvent = SignalEvent;
//# sourceMappingURL=SignalEvent.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"SignalEvent.js","sourceRoot":"","sources":["../../../src/OpenViduInternal/Events/SignalEvent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;AAEH,iCAAgC;AAKhC;;;;GAIG;AACH;IAAiC,+BAAK;IAqBlC;;OAEG;IACH,qBAAY,MAAe,EAAE,IAAY,EAAE,IAAY,EAAE,IAAgB;QAAzE,YACI,kBAAM,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,SAI7B;QAHG,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;;IACrB,CAAC;IAED;;OAEG;IACH,oCAAoC;IACpC,yCAAmB,GAAnB,cAAwB,CAAC;IAE7B,kBAAC;AAAD,CAAC,AArCD,CAAiC,aAAK,GAqCrC;AArCY,kCAAW"}

View File

@ -1,37 +0,0 @@
import { Event } from './Event';
import { Publisher } from '../../OpenVidu/Publisher';
import { Session } from '../../OpenVidu/Session';
import { Stream } from '../../OpenVidu/Stream';
/**
* Defines the following events:
* - `streamCreated`: dispatched by [[Session]] and [[Publisher]]
* - `streamDestroyed`: dispatched by [[Session]] and [[Publisher]]
*/
export declare class StreamEvent extends Event {
/**
* Stream object that was created or destroyed
*/
stream: Stream;
/**
* For 'streamDestroyed' event:
* - "unpublish": method `Session.unpublish()` has been called
* - "disconnect": method `Session.disconnect()` has been called
* - "forceUnpublishByUser": some user has called `Session.forceUnpublish()` over the Stream
* - "forceDisconnectByUser": some user has called `Session.forceDisconnect()` over the Stream
* - "forceUnpublishByServer": the user's stream has been unpublished from the Session by the application
* - "forceDisconnectByServer": the user has been evicted from the Session by the application
* - "sessionClosedByServer": the Session has been closed by the application
* - "networkDisconnect": the user's network connection has dropped
*
* For 'streamCreated' empty string
*/
reason: string;
/**
* @hidden
*/
constructor(cancelable: boolean, target: Session | Publisher, type: string, stream: Stream, reason: string);
/**
* @hidden
*/
callDefaultBehavior(): void;
}

View File

@ -1,98 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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 __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
var Event_1 = require("./Event");
var Publisher_1 = require("../../OpenVidu/Publisher");
var Session_1 = require("../../OpenVidu/Session");
/**
* Defines the following events:
* - `streamCreated`: dispatched by [[Session]] and [[Publisher]]
* - `streamDestroyed`: dispatched by [[Session]] and [[Publisher]]
*/
var StreamEvent = /** @class */ (function (_super) {
__extends(StreamEvent, _super);
/**
* @hidden
*/
function StreamEvent(cancelable, target, type, stream, reason) {
var _this = _super.call(this, cancelable, target, type) || this;
_this.stream = stream;
_this.reason = reason;
return _this;
}
/**
* @hidden
*/
StreamEvent.prototype.callDefaultBehavior = function () {
if (this.type === 'streamDestroyed') {
if (this.target instanceof Session_1.Session) {
// Remote Stream
console.info("Calling default behavior upon '" + this.type + "' event dispatched by 'Session'");
this.stream.disposeWebRtcPeer();
}
else if (this.target instanceof Publisher_1.Publisher) {
// Local Stream
console.info("Calling default behavior upon '" + this.type + "' event dispatched by 'Publisher'");
clearInterval(this.target.screenShareResizeInterval);
this.stream.isLocalStreamReadyToPublish = false;
// Delete Publisher object from OpenVidu publishers array
var openviduPublishers = this.target.openvidu.publishers;
for (var i = 0; i < openviduPublishers.length; i++) {
if (openviduPublishers[i] === this.target) {
openviduPublishers.splice(i, 1);
break;
}
}
}
// Dispose the MediaStream local object
this.stream.disposeMediaStream();
// Remove from DOM all video elements associated to this Stream, if there's a StreamManager defined
// (method Session.subscribe must have been called)
if (this.stream.streamManager)
this.stream.streamManager.removeAllVideos();
// Delete stream from Session.remoteStreamsCreated map
delete this.stream.session.remoteStreamsCreated[this.stream.streamId];
// Delete StreamOptionsServer from remote Connection
var remoteConnection = this.stream.session.remoteConnections[this.stream.connection.connectionId];
if (!!remoteConnection && !!remoteConnection.options) {
var streamOptionsServer = remoteConnection.options.streams;
for (var i = streamOptionsServer.length - 1; i >= 0; --i) {
if (streamOptionsServer[i].id === this.stream.streamId) {
streamOptionsServer.splice(i, 1);
}
}
}
}
};
return StreamEvent;
}(Event_1.Event));
exports.StreamEvent = StreamEvent;
//# sourceMappingURL=StreamEvent.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"StreamEvent.js","sourceRoot":"","sources":["../../../src/OpenViduInternal/Events/StreamEvent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;AAEH,iCAAgC;AAChC,sDAAqD;AACrD,kDAAiD;AAIjD;;;;GAIG;AACH;IAAiC,+BAAK;IAsBlC;;OAEG;IACH,qBAAY,UAAmB,EAAE,MAA2B,EAAE,IAAY,EAAE,MAAc,EAAE,MAAc;QAA1G,YACI,kBAAM,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,SAGlC;QAFG,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACzB,CAAC;IAED;;OAEG;IACH,yCAAmB,GAAnB;QACI,IAAI,IAAI,CAAC,IAAI,KAAK,iBAAiB,EAAE;YAEjC,IAAI,IAAI,CAAC,MAAM,YAAY,iBAAO,EAAE;gBAChC,gBAAgB;gBAChB,OAAO,CAAC,IAAI,CAAC,iCAAiC,GAAG,IAAI,CAAC,IAAI,GAAG,iCAAiC,CAAC,CAAC;gBAChG,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;aACnC;iBAAM,IAAI,IAAI,CAAC,MAAM,YAAY,qBAAS,EAAE;gBACzC,eAAe;gBACf,OAAO,CAAC,IAAI,CAAC,iCAAiC,GAAG,IAAI,CAAC,IAAI,GAAG,mCAAmC,CAAC,CAAC;gBAClG,aAAa,CAAa,IAAI,CAAC,MAAO,CAAC,yBAAyB,CAAC,CAAC;gBAClE,IAAI,CAAC,MAAM,CAAC,2BAA2B,GAAG,KAAK,CAAC;gBAEhD,yDAAyD;gBACzD,IAAM,kBAAkB,GAAe,IAAI,CAAC,MAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;gBACxE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,kBAAkB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBAChD,IAAI,kBAAkB,CAAC,CAAC,CAAC,KAAiB,IAAI,CAAC,MAAO,EAAE;wBACpD,kBAAkB,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;wBAChC,MAAM;qBACT;iBACJ;aACJ;YAED,uCAAuC;YACvC,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC;YAEjC,mGAAmG;YACnG,mDAAmD;YACnD,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa;gBAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,eAAe,EAAE,CAAC;YAE3E,sDAAsD;YACtD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAEtE,oDAAoD;YACpD,IAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;YACpG,IAAI,CAAC,CAAC,gBAAgB,IAAI,CAAC,CAAC,gBAAgB,CAAC,OAAO,EAAE;gBAClD,IAAM,mBAAmB,GAAG,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC;gBAC7D,KAAK,IAAI,CAAC,GAAG,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE;oBACtD,IAAI,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;wBACpD,mBAAmB,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;qBACpC;iBACJ;aACJ;SAEJ;IACL,CAAC;IAEL,kBAAC;AAAD,CAAC,AAjFD,CAAiC,aAAK,GAiFrC;AAjFY,kCAAW"}

View File

@ -1,28 +0,0 @@
import { Event } from './Event';
import { StreamManager } from '../../OpenVidu/StreamManager';
/**
* Defines the following events:
* - `streamPlaying`: dispatched by [[StreamManager]] ([[Publisher]] and [[Subscriber]]) whenever its media stream starts playing (one of its videos has media
* and has begun to play)
* - `streamAudioVolumeChange`: dispatched by [[StreamManager]] ([[Publisher]] and [[Subscriber]]) when the volume of its Stream's audio track
* changes. Only applies if [[Stream.hasAudio]] is `true`. The frequency this event is fired with is defined by property `interval` of
* [[OpenViduAdvancedConfiguration.publisherSpeakingEventsOptions]] (default 50ms)
*/
export declare class StreamManagerEvent extends Event {
/**
* For `streamAudioVolumeChange` event:
* - `{newValue: number, oldValue: number}`: new and old audio volume values. These values are between -100 (silence) and 0 (loudest possible volume).
* They are not exact and depend on how the browser is managing the audio track, but -100 and 0 can be taken as limit values.
*
* For `streamPlaying` event undefined
*/
value: Object | undefined;
/**
* @hidden
*/
constructor(target: StreamManager, type: string, value: Object | undefined);
/**
* @hidden
*/
callDefaultBehavior(): void;
}

View File

@ -1,59 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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 __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
var Event_1 = require("./Event");
/**
* Defines the following events:
* - `streamPlaying`: dispatched by [[StreamManager]] ([[Publisher]] and [[Subscriber]]) whenever its media stream starts playing (one of its videos has media
* and has begun to play)
* - `streamAudioVolumeChange`: dispatched by [[StreamManager]] ([[Publisher]] and [[Subscriber]]) when the volume of its Stream's audio track
* changes. Only applies if [[Stream.hasAudio]] is `true`. The frequency this event is fired with is defined by property `interval` of
* [[OpenViduAdvancedConfiguration.publisherSpeakingEventsOptions]] (default 50ms)
*/
var StreamManagerEvent = /** @class */ (function (_super) {
__extends(StreamManagerEvent, _super);
/**
* @hidden
*/
function StreamManagerEvent(target, type, value) {
var _this = _super.call(this, false, target, type) || this;
_this.value = value;
return _this;
}
/**
* @hidden
*/
// tslint:disable-next-line:no-empty
StreamManagerEvent.prototype.callDefaultBehavior = function () { };
return StreamManagerEvent;
}(Event_1.Event));
exports.StreamManagerEvent = StreamManagerEvent;
//# sourceMappingURL=StreamManagerEvent.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"StreamManagerEvent.js","sourceRoot":"","sources":["../../../src/OpenViduInternal/Events/StreamManagerEvent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;AAEH,iCAAgC;AAGhC;;;;;;;GAOG;AACH;IAAwC,sCAAK;IAWzC;;OAEG;IACH,4BAAY,MAAqB,EAAE,IAAY,EAAE,KAAyB;QAA1E,YACI,kBAAM,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,SAE7B;QADG,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;;IACvB,CAAC;IAED;;OAEG;IACH,oCAAoC;IACpC,gDAAmB,GAAnB,cAAwB,CAAC;IAE7B,yBAAC;AAAD,CAAC,AAzBD,CAAwC,aAAK,GAyB5C;AAzBY,gDAAkB"}

View File

@ -1,42 +0,0 @@
import { Event } from './Event';
import { Session } from '../../OpenVidu/Session';
import { Stream } from '../../OpenVidu/Stream';
import { StreamManager } from '../../OpenVidu/StreamManager';
/**
* Defines event `streamPropertyChanged` dispatched by [[Session]] as well as by [[StreamManager]] ([[Publisher]] and [[Subscriber]]).
* This event is fired when any remote stream (owned by a Subscriber) or local stream (owned by a Publisher) undergoes
* any change in any of its mutable properties (see [[changedProperty]]).
*/
export declare class StreamPropertyChangedEvent extends Event {
/**
* The Stream whose property has changed. You can always identify the user publishing the changed stream by consulting property [[Stream.connection]]
*/
stream: Stream;
/**
* The property of the stream that changed. This value is either `"videoActive"`, `"audioActive"`, `"videoDimensions"` or `"filter"`
*/
changedProperty: string;
/**
* Cause of the change on the stream's property:
* - For `videoActive`: `"publishVideo"`
* - For `audioActive`: `"publishAudio"`
* - For `videoDimensions`: `"deviceRotated"` or `"screenResized"`
*/
reason: string;
/**
* New value of the property (after change, current value)
*/
newValue: Object;
/**
* Previous value of the property (before change)
*/
oldValue: Object;
/**
* @hidden
*/
constructor(target: Session | StreamManager, stream: Stream, changedProperty: string, newValue: Object, oldValue: Object, reason: string);
/**
* @hidden
*/
callDefaultBehavior(): void;
}

View File

@ -1,60 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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 __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
var Event_1 = require("./Event");
/**
* Defines event `streamPropertyChanged` dispatched by [[Session]] as well as by [[StreamManager]] ([[Publisher]] and [[Subscriber]]).
* This event is fired when any remote stream (owned by a Subscriber) or local stream (owned by a Publisher) undergoes
* any change in any of its mutable properties (see [[changedProperty]]).
*/
var StreamPropertyChangedEvent = /** @class */ (function (_super) {
__extends(StreamPropertyChangedEvent, _super);
/**
* @hidden
*/
function StreamPropertyChangedEvent(target, stream, changedProperty, newValue, oldValue, reason) {
var _this = _super.call(this, false, target, 'streamPropertyChanged') || this;
_this.stream = stream;
_this.changedProperty = changedProperty;
_this.newValue = newValue;
_this.oldValue = oldValue;
_this.reason = reason;
return _this;
}
/**
* @hidden
*/
// tslint:disable-next-line:no-empty
StreamPropertyChangedEvent.prototype.callDefaultBehavior = function () { };
return StreamPropertyChangedEvent;
}(Event_1.Event));
exports.StreamPropertyChangedEvent = StreamPropertyChangedEvent;
//# sourceMappingURL=StreamPropertyChangedEvent.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"StreamPropertyChangedEvent.js","sourceRoot":"","sources":["../../../src/OpenViduInternal/Events/StreamPropertyChangedEvent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;AAEH,iCAAgC;AAKhC;;;;GAIG;AACH;IAAgD,8CAAK;IA8BjD;;OAEG;IACH,oCAAY,MAA+B,EAAE,MAAc,EAAE,eAAuB,EAAE,QAAgB,EAAE,QAAgB,EAAE,MAAc;QAAxI,YACI,kBAAM,KAAK,EAAE,MAAM,EAAE,uBAAuB,CAAC,SAMhD;QALG,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACzB,CAAC;IAED;;OAEG;IACH,oCAAoC;IACpC,wDAAmB,GAAnB,cAAwB,CAAC;IAE7B,iCAAC;AAAD,CAAC,AAhDD,CAAgD,aAAK,GAgDpD;AAhDY,gEAA0B"}

View File

@ -1,22 +0,0 @@
import { Event } from './Event';
import { StreamManager } from '../../OpenVidu/StreamManager';
/**
* Defines the following events:
* - `videoElementCreated`: dispatched by [[Publisher]] and [[Subscriber]] whenever a new HTML video element has been inserted into DOM by OpenVidu Browser library. See
* [Manage video players](/docs/how-do-i/manage-videos) section.
* - `videoElementDestroyed`: dispatched by [[Publisher]] and [[Subscriber]] whenever an HTML video element has been removed from DOM by OpenVidu Browser library.
*/
export declare class VideoElementEvent extends Event {
/**
* Video element that was created or destroyed
*/
element: HTMLVideoElement;
/**
* @hidden
*/
constructor(element: HTMLVideoElement, target: StreamManager, type: string);
/**
* @hidden
*/
callDefaultBehavior(): void;
}

View File

@ -1,57 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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 __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
var Event_1 = require("./Event");
/**
* Defines the following events:
* - `videoElementCreated`: dispatched by [[Publisher]] and [[Subscriber]] whenever a new HTML video element has been inserted into DOM by OpenVidu Browser library. See
* [Manage video players](/docs/how-do-i/manage-videos) section.
* - `videoElementDestroyed`: dispatched by [[Publisher]] and [[Subscriber]] whenever an HTML video element has been removed from DOM by OpenVidu Browser library.
*/
var VideoElementEvent = /** @class */ (function (_super) {
__extends(VideoElementEvent, _super);
/**
* @hidden
*/
function VideoElementEvent(element, target, type) {
var _this = _super.call(this, false, target, type) || this;
_this.element = element;
return _this;
}
/**
* @hidden
*/
// tslint:disable-next-line:no-empty
VideoElementEvent.prototype.callDefaultBehavior = function () { };
return VideoElementEvent;
}(Event_1.Event));
exports.VideoElementEvent = VideoElementEvent;
//# sourceMappingURL=VideoElementEvent.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"VideoElementEvent.js","sourceRoot":"","sources":["../../../src/OpenViduInternal/Events/VideoElementEvent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;AAEH,iCAAgC;AAIhC;;;;;GAKG;AACH;IAAuC,qCAAK;IAOxC;;OAEG;IACH,2BAAY,OAAyB,EAAE,MAAqB,EAAE,IAAY;QAA1E,YACI,kBAAM,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,SAE7B;QADG,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;;IAC3B,CAAC;IAED;;OAEG;IACH,oCAAoC;IACpC,+CAAmB,GAAnB,cAAwB,CAAC;IAE7B,wBAAC;AAAD,CAAC,AArBD,CAAuC,aAAK,GAqB3C;AArBY,8CAAiB"}

View File

@ -1,6 +0,0 @@
import { StreamOptionsServer } from './StreamOptionsServer';
export interface ConnectionOptions {
id: string;
metadata: string;
streams: StreamOptionsServer[];
}

View File

@ -1,19 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
//# sourceMappingURL=ConnectionOptions.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"ConnectionOptions.js","sourceRoot":"","sources":["../../../../src/OpenViduInternal/Interfaces/Private/ConnectionOptions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}

View File

@ -1,17 +0,0 @@
import { Connection } from '../../../OpenVidu/Connection';
import { Filter } from '../../../OpenVidu/Filter';
export interface InboundStreamOptions {
id: string;
connection: Connection;
hasAudio: boolean;
hasVideo: boolean;
audioActive: boolean;
videoActive: boolean;
typeOfVideo: string;
frameRate: number;
videoDimensions: {
width: number;
height: number;
};
filter?: Filter;
}

View File

@ -1,19 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
//# sourceMappingURL=InboundStreamOptions.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"InboundStreamOptions.js","sourceRoot":"","sources":["../../../../src/OpenViduInternal/Interfaces/Private/InboundStreamOptions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}

View File

@ -1,3 +0,0 @@
export interface ObjMap<T> {
[s: string]: T;
}

View File

@ -1,19 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
//# sourceMappingURL=ObjMap.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"ObjMap.js","sourceRoot":"","sources":["../../../../src/OpenViduInternal/Interfaces/Private/ObjMap.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}

View File

@ -1,5 +0,0 @@
import { PublisherProperties } from '../Public/PublisherProperties';
export interface OutboundStreamOptions {
publisherProperties: PublisherProperties;
mediaConstraints: MediaStreamConstraints;
}

View File

@ -1,19 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
//# sourceMappingURL=OutboundStreamOptions.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"OutboundStreamOptions.js","sourceRoot":"","sources":["../../../../src/OpenViduInternal/Interfaces/Private/OutboundStreamOptions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}

View File

@ -1,5 +0,0 @@
export interface SessionOptions {
sessionId: string;
participantId: string;
metadata: string;
}

View File

@ -1,19 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
//# sourceMappingURL=SessionOptions.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"SessionOptions.js","sourceRoot":"","sources":["../../../../src/OpenViduInternal/Interfaces/Private/SessionOptions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}

View File

@ -1,12 +0,0 @@
import { Filter } from '../../../OpenVidu/Filter';
export interface StreamOptionsServer {
id: string;
hasAudio: boolean;
hasVideo: boolean;
audioActive: boolean;
videoActive: boolean;
typeOfVideo: string;
frameRate: number;
videoDimensions: string;
filter: Filter;
}

View File

@ -1,19 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
//# sourceMappingURL=StreamOptionsServer.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"StreamOptionsServer.js","sourceRoot":"","sources":["../../../../src/OpenViduInternal/Interfaces/Private/StreamOptionsServer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}

View File

@ -1,21 +0,0 @@
/**
* See [[Session.capabilities]]
*/
export interface Capabilities {
/**
* `true` if the client can call [[Session.forceDisconnect]], `false` if not
*/
forceDisconnect: boolean;
/**
* `true` if the client can call [[Session.forceUnpublish]], `false` if not
*/
forceUnpublish: boolean;
/**
* `true` if the client can call [[Session.publish]], `false` if not
*/
publish: boolean;
/**
* `true` if the client can call [[Session.subscribe]], `false` if not (true for every user for now)
*/
subscribe: boolean;
}

View File

@ -1,19 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
//# sourceMappingURL=Capabilities.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Capabilities.js","sourceRoot":"","sources":["../../../../src/OpenViduInternal/Interfaces/Public/Capabilities.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}

View File

@ -1,17 +0,0 @@
/**
* See [[OpenVidu.getDevices]]
*/
export interface Device {
/**
* `"videoinput"`, `"audioinput"`
*/
kind: string;
/**
* Unique ID for the device. Use it on `audioSource` or `videoSource` properties of [[PublisherProperties]]
*/
deviceId: string;
/**
* Description of the device. An empty string if the user hasn't granted permissions to the site to access the device
*/
label: string;
}

View File

@ -1,19 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
//# sourceMappingURL=Device.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"Device.js","sourceRoot":"","sources":["../../../../src/OpenViduInternal/Interfaces/Public/Device.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}

View File

@ -1,21 +0,0 @@
import { Event as Event } from '../../Events/Event';
export interface EventDispatcher {
/**
* Adds function `handler` to handle event `type`
*
* @returns The EventDispatcher object
*/
on(type: string, handler: (event: Event) => void): EventDispatcher;
/**
* Adds function `handler` to handle event `type` just once. The handler will be automatically removed after first execution
*
* @returns The object that dispatched the event
*/
once(type: string, handler: (event: Event) => void): Object;
/**
* Removes a `handler` from event `type`. If no handler is provided, all handlers will be removed from the event
*
* @returns The object that dispatched the event
*/
off(type: string, handler?: (event: Event) => void): Object;
}

View File

@ -1,19 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
//# sourceMappingURL=EventDispatcher.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"EventDispatcher.js","sourceRoot":"","sources":["../../../../src/OpenViduInternal/Interfaces/Public/EventDispatcher.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}

View File

@ -1,21 +0,0 @@
/**
* See [[OpenVidu.setAdvancedConfiguration]]
*/
export interface OpenViduAdvancedConfiguration {
/**
* Array of [RTCIceServer](https://developer.mozilla.org/en-US/docs/Web/API/RTCIceServer) to be used by OpenVidu Browser. By default OpenVidu will generate the required credentials to use the COTURN server hosted along OpenVidu Server
* You can also set this property to string 'freeice' to force the use of free STUN servers instead (got thanks to [freeice](https://github.com/DamonOehlman/freeice) library).
*/
iceServers?: RTCIceServer[] | string;
/**
* URL to a custom screen share extension for Chrome (always based on ours: [openvidu-screen-sharing-chrome-extension](https://github.com/OpenVidu/openvidu-screen-sharing-chrome-extension)) to be used instead of the default one.
* Must be something like this: `https://chrome.google.com/webstore/detail/YOUR_WEBSTORE_EXTENSION_NAME/YOUR_EXTENSION_ID`
*/
screenShareChromeExtension?: string;
/**
* Custom configuration for the [[PublisherSpeakingEvent]] feature. It is an object which includes the following optional properties:
* - `interval`: (number) how frequently the analyser polls the audio stream to check if speaking has started or stopped. Default **50** (ms)
* - `threshold`: (number) the volume at which _publisherStartSpeaking_ and _publisherStopSpeaking_ events will be fired. Default **-50** (dB)
*/
publisherSpeakingEventsOptions?: any;
}

View File

@ -1,19 +0,0 @@
"use strict";
/*
* (C) Copyright 2017-2018 OpenVidu (https://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.
*
*/
exports.__esModule = true;
//# sourceMappingURL=OpenViduAdvancedConfiguration.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"OpenViduAdvancedConfiguration.js","sourceRoot":"","sources":["../../../../src/OpenViduInternal/Interfaces/Public/OpenViduAdvancedConfiguration.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}

Some files were not shown because too many files have changed in this diff Show More