mirror of https://github.com/OpenVidu/openvidu.git
Update to version v2.7.0
parent
8b8e4a4cfb
commit
1e2dd2fe8c
|
@ -3,7 +3,9 @@ import { LocalRecorderState } from '../OpenViduInternal/Enums/LocalRecorderState
|
|||
/**
|
||||
* Easy recording of [[Stream]] objects straightaway from the browser. Initialized with [[OpenVidu.initLocalRecorder]] method
|
||||
*
|
||||
* > WARNING: 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
|
||||
* > 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;
|
||||
|
@ -12,10 +14,8 @@ export declare class LocalRecorder {
|
|||
private mediaRecorder;
|
||||
private chunks;
|
||||
private blob;
|
||||
private count;
|
||||
private id;
|
||||
private videoPreviewSrc;
|
||||
private htmlParentElementId;
|
||||
private videoPreview;
|
||||
/**
|
||||
* @hidden
|
||||
|
|
|
@ -17,10 +17,13 @@
|
|||
*/
|
||||
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
|
||||
*
|
||||
* > WARNING: 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
|
||||
* > 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 () {
|
||||
/**
|
||||
|
@ -29,7 +32,6 @@ var LocalRecorder = /** @class */ (function () {
|
|||
function LocalRecorder(stream) {
|
||||
this.stream = stream;
|
||||
this.chunks = [];
|
||||
this.count = 0;
|
||||
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;
|
||||
|
@ -168,15 +170,16 @@ var LocalRecorder = /** @class */ (function () {
|
|||
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') {
|
||||
this.htmlParentElementId = parentElement;
|
||||
var parentElementDom = document.getElementById(parentElement);
|
||||
if (parentElementDom) {
|
||||
this.videoPreview = parentElementDom.appendChild(this.videoPreview);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.htmlParentElementId = parentElement.id;
|
||||
this.videoPreview = parentElement.appendChild(this.videoPreview);
|
||||
}
|
||||
this.videoPreview.src = this.videoPreviewSrc;
|
||||
|
@ -190,7 +193,6 @@ var LocalRecorder = /** @class */ (function () {
|
|||
var f = function () {
|
||||
delete _this.blob;
|
||||
_this.chunks = [];
|
||||
_this.count = 0;
|
||||
delete _this.mediaRecorder;
|
||||
_this.state = LocalRecorderState_1.LocalRecorderState.READY;
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -70,7 +70,7 @@ export declare class OpenVidu {
|
|||
*/
|
||||
checkSystemRequirements(): number;
|
||||
/**
|
||||
* Checks if the browser supports screen-sharing. Chrome, Firefox and Opera support screen-sharing
|
||||
* 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;
|
||||
|
|
|
@ -26,6 +26,7 @@ var screenSharingAuto = require("../OpenViduInternal/ScreenSharing/Screen-Captur
|
|||
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]]
|
||||
|
@ -50,28 +51,42 @@ var OpenVidu = /** @class */ (function () {
|
|||
*/
|
||||
this.advancedConfiguration = {};
|
||||
console.info("'OpenVidu' initialized");
|
||||
if (platform.name.toLowerCase().indexOf('mobile') !== -1) {
|
||||
// Listen to orientationchange only on mobile browsers
|
||||
window.onorientationchange = function () {
|
||||
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;
|
||||
// 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_1 = publisher.stream.getMediaStream().getVideoTracks()[0].getSettings();
|
||||
var newWidth_1 = (platform.name.toLowerCase().indexOf('firefox') !== -1) ? firefoxSettings_1.width : publisher.videoReference.videoWidth;
|
||||
var newHeight_1 = (platform.name.toLowerCase().indexOf('firefox') !== -1) ? firefoxSettings_1.height : publisher.videoReference.videoHeight;
|
||||
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 () {
|
||||
firefoxSettings_1 = publisher.stream.getMediaStream().getVideoTracks()[0].getSettings();
|
||||
newWidth_1 = (platform.name.toLowerCase().indexOf('firefox') !== -1) ? firefoxSettings_1.width : publisher.videoReference.videoWidth;
|
||||
newHeight_1 = (platform.name.toLowerCase().indexOf('firefox') !== -1) ? firefoxSettings_1.height : publisher.videoReference.videoHeight;
|
||||
sendStreamPropertyChangedEvent_1(oldWidth_1, oldHeight_1, newWidth_1, newHeight_1);
|
||||
}, 100);
|
||||
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 > 4) {
|
||||
if (attempts_1 > 10) {
|
||||
clearTimeout(repeatUntilChange_1);
|
||||
}
|
||||
if (newWidth !== oldWidth || newHeight !== oldHeight) {
|
||||
|
@ -98,14 +113,13 @@ var OpenVidu = /** @class */ (function () {
|
|||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns new session
|
||||
*/
|
||||
OpenVidu.prototype.initSession = function () {
|
||||
console.warn("OEeeeeee");
|
||||
this.session = new Session_1.Session(this);
|
||||
return this.session;
|
||||
};
|
||||
|
@ -212,11 +226,19 @@ var OpenVidu = /** @class */ (function () {
|
|||
*/
|
||||
OpenVidu.prototype.checkSystemRequirements = function () {
|
||||
var browser = platform.name;
|
||||
var version = platform.version;
|
||||
if ((browser !== 'Chrome') && (browser !== 'Chrome Mobile') &&
|
||||
(browser !== 'Firefox') && (browser !== 'Firefox Mobile') && (browser !== 'Firefox for iOS') &&
|
||||
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 !== 'Safari') && (browser !== 'Android Browser')) {
|
||||
(browser !== 'Android Browser')) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
|
@ -224,11 +246,16 @@ var OpenVidu = /** @class */ (function () {
|
|||
}
|
||||
};
|
||||
/**
|
||||
* Checks if the browser supports screen-sharing. Chrome, Firefox and Opera support screen-sharing
|
||||
* 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;
|
||||
}
|
||||
|
@ -402,7 +429,7 @@ var OpenVidu = /** @class */ (function () {
|
|||
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 and Firefox. Detected browser: ' + platform.name);
|
||||
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);
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -45,6 +45,8 @@ export declare class Publisher extends StreamManager {
|
|||
*
|
||||
* #### 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
|
||||
*
|
||||
|
@ -61,6 +63,8 @@ export declare class Publisher extends StreamManager {
|
|||
*
|
||||
* #### 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
|
||||
*
|
||||
|
|
|
@ -21,7 +21,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; }
|
||||
|
@ -37,6 +37,7 @@ var StreamPropertyChangedEvent_1 = require("../OpenViduInternal/Events/StreamPro
|
|||
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
|
||||
*/
|
||||
|
@ -71,6 +72,8 @@ var Publisher = /** @class */ (function (_super) {
|
|||
*
|
||||
* #### 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
|
||||
*
|
||||
|
@ -87,20 +90,22 @@ var Publisher = /** @class */ (function (_super) {
|
|||
this.stream.getMediaStream().getAudioTracks().forEach(function (track) {
|
||||
track.enabled = value;
|
||||
});
|
||||
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')]);
|
||||
}
|
||||
});
|
||||
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');
|
||||
}
|
||||
|
@ -110,6 +115,8 @@ var Publisher = /** @class */ (function (_super) {
|
|||
*
|
||||
* #### 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
|
||||
*
|
||||
|
@ -126,20 +133,22 @@ var Publisher = /** @class */ (function (_super) {
|
|||
this.stream.getMediaStream().getVideoTracks().forEach(function (track) {
|
||||
track.enabled = value;
|
||||
});
|
||||
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')]);
|
||||
}
|
||||
});
|
||||
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');
|
||||
}
|
||||
|
@ -259,6 +268,9 @@ var Publisher = /** @class */ (function (_super) {
|
|||
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()) {
|
||||
|
@ -272,26 +284,56 @@ var Publisher = /** @class */ (function (_super) {
|
|||
delete _this.firstVideoElement;
|
||||
if (_this.stream.isSendVideo()) {
|
||||
if (!_this.stream.isSendScreen()) {
|
||||
// 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)
|
||||
//const { width, height } = mediaStream.getVideoTracks()[0].getSettings();
|
||||
var width = 700;
|
||||
var height = 480;
|
||||
if (platform.name.toLowerCase().indexOf('mobile') !== -1 && (window.innerHeight > window.innerWidth)) {
|
||||
// Mobile portrait mode
|
||||
_this.stream.videoDimensions = {
|
||||
width: height || 0,
|
||||
height: width || 0
|
||||
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 {
|
||||
_this.stream.videoDimensions = {
|
||||
width: width || 0,
|
||||
height: height || 0
|
||||
};
|
||||
// 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', []);
|
||||
}
|
||||
_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)
|
||||
|
@ -302,8 +344,8 @@ var Publisher = /** @class */ (function (_super) {
|
|||
};
|
||||
_this.screenShareResizeInterval = setInterval(function () {
|
||||
var firefoxSettings = mediaStream.getVideoTracks()[0].getSettings();
|
||||
var newWidth = (platform.name === 'Chrome') ? _this.videoReference.videoWidth : firefoxSettings.width;
|
||||
var newHeight = (platform.name === 'Chrome') ? _this.videoReference.videoHeight : firefoxSettings.height;
|
||||
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)) {
|
||||
|
@ -389,6 +431,10 @@ var Publisher = /** @class */ (function (_super) {
|
|||
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':
|
||||
|
@ -420,6 +466,10 @@ var Publisher = /** @class */ (function (_super) {
|
|||
}
|
||||
})["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':
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -44,6 +44,14 @@ export declare class Session implements EventDispatcher {
|
|||
* @hidden
|
||||
*/
|
||||
remoteStreamsCreated: ObjMap<boolean>;
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
isFirstIonicIosSubscriber: boolean;
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
countDownForIonicIosSubscribers: boolean;
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
|
|
|
@ -28,8 +28,8 @@ var StreamEvent_1 = require("../OpenViduInternal/Events/StreamEvent");
|
|||
var StreamPropertyChangedEvent_1 = require("../OpenViduInternal/Events/StreamPropertyChangedEvent");
|
||||
var OpenViduError_1 = require("../OpenViduInternal/Enums/OpenViduError");
|
||||
var VideoInsertMode_1 = require("../OpenViduInternal/Enums/VideoInsertMode");
|
||||
var platform = require("platform");
|
||||
var EventEmitter = require("wolfy87-eventemitter");
|
||||
var platform = require("platform");
|
||||
/**
|
||||
* 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.
|
||||
|
@ -49,6 +49,14 @@ var Session = /** @class */ (function () {
|
|||
* @hidden
|
||||
*/
|
||||
this.remoteStreamsCreated = {};
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
this.isFirstIonicIosSubscriber = true;
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
this.countDownForIonicIosSubscribers = true;
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
|
@ -63,7 +71,7 @@ var Session = /** @class */ (function () {
|
|||
/**
|
||||
* Connects to the session using `token`. Parameter `metadata` allows you to pass extra data to share with other users when
|
||||
* they receive `streamCreated` event. The structure of `metadata` string is up to you (maybe some standardized format
|
||||
* as JSON or XML is a good idea), the only restriction is a maximum length of 10000 chars.
|
||||
* as JSON or XML is a good idea).
|
||||
*
|
||||
* This metadata is not considered secure, as it is generated in the client side. To pass secure data, add it as a parameter in the
|
||||
* token generation operation (through the API REST, openvidu-java-client or openvidu-node-client).
|
||||
|
@ -105,7 +113,7 @@ var Session = /** @class */ (function () {
|
|||
});
|
||||
}
|
||||
else {
|
||||
reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.BROWSER_NOT_SUPPORTED, 'Browser ' + platform.name + ' ' + platform.version + ' is not supported in OpenVidu'));
|
||||
reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.BROWSER_NOT_SUPPORTED, 'Browser ' + platform.name + ' for ' + platform.os.family + ' is not supported in OpenVidu'));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -466,7 +474,7 @@ var Session = /** @class */ (function () {
|
|||
// If there are already available remote streams, enable hark 'speaking' event in all of them
|
||||
for (var connectionId in this.remoteConnections) {
|
||||
var str = this.remoteConnections[connectionId].stream;
|
||||
if (!!str && !str.speechEvent && str.hasAudio) {
|
||||
if (!!str && str.hasAudio) {
|
||||
str.enableSpeakingEvents();
|
||||
}
|
||||
}
|
||||
|
@ -491,7 +499,7 @@ var Session = /** @class */ (function () {
|
|||
// If there are already available remote streams, enable hark in all of them
|
||||
for (var connectionId in this.remoteConnections) {
|
||||
var str = this.remoteConnections[connectionId].stream;
|
||||
if (!!str && !str.speechEvent && str.hasAudio) {
|
||||
if (!!str && str.hasAudio) {
|
||||
str.enableOnceSpeakingEvents();
|
||||
}
|
||||
}
|
||||
|
@ -513,7 +521,7 @@ var Session = /** @class */ (function () {
|
|||
// If there are already available remote streams, disable hark in all of them
|
||||
for (var connectionId in this.remoteConnections) {
|
||||
var str = this.remoteConnections[connectionId].stream;
|
||||
if (!!str && !!str.speechEvent) {
|
||||
if (!!str) {
|
||||
str.disableSpeakingEvents();
|
||||
}
|
||||
}
|
||||
|
@ -550,6 +558,10 @@ var Session = /** @class */ (function () {
|
|||
_this.ee.emitEvent('streamDestroyed', [streamEvent]);
|
||||
streamEvent.callDefaultBehavior();
|
||||
delete _this.remoteStreamsCreated[stream.streamId];
|
||||
if (Object.keys(_this.remoteStreamsCreated).length === 0) {
|
||||
_this.isFirstIonicIosSubscriber = true;
|
||||
_this.countDownForIonicIosSubscribers = true;
|
||||
}
|
||||
}
|
||||
delete _this.remoteConnections[connection.connectionId];
|
||||
_this.ee.emitEvent('connectionDestroyed', [new ConnectionEvent_1.ConnectionEvent(false, _this, 'connectionDestroyed', connection, msg.reason)]);
|
||||
|
@ -609,6 +621,10 @@ var Session = /** @class */ (function () {
|
|||
// Deleting the remote stream
|
||||
var streamId = connection.stream.streamId;
|
||||
delete _this.remoteStreamsCreated[streamId];
|
||||
if (Object.keys(_this.remoteStreamsCreated).length === 0) {
|
||||
_this.isFirstIonicIosSubscriber = true;
|
||||
_this.countDownForIonicIosSubscribers = true;
|
||||
}
|
||||
connection.removeStream(streamId);
|
||||
})["catch"](function (openViduError) {
|
||||
console.error(openViduError);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -117,6 +117,18 @@ export declare class Stream implements EventDispatcher {
|
|||
* @hidden
|
||||
*/
|
||||
speechEvent: any;
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
publisherStartSpeakingEventEnabled: boolean;
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
publisherStopSpeakingEventEnabled: boolean;
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
volumeChangeEventEnabled: boolean;
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
|
@ -224,6 +236,18 @@ export declare class Stream implements EventDispatcher {
|
|||
* @hidden
|
||||
*/
|
||||
disableSpeakingEvents(): void;
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
enableVolumeChangeEvent(): void;
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
enableOnceVolumeChangeEvent(): void;
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
disableVolumeChangeEvent(): void;
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
|
|
|
@ -20,10 +20,13 @@ 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 OpenViduError_1 = require("../OpenViduInternal/Enums/OpenViduError");
|
||||
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
|
||||
|
@ -52,6 +55,18 @@ var Stream = /** @class */ (function () {
|
|||
* @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
|
||||
|
@ -308,6 +323,7 @@ var Stream = /** @class */ (function () {
|
|||
}
|
||||
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');
|
||||
|
@ -373,12 +389,18 @@ var Stream = /** @class */ (function () {
|
|||
Stream.prototype.enableSpeakingEvents = function () {
|
||||
var _this = this;
|
||||
this.setSpeechEventIfNotExists();
|
||||
this.speechEvent.on('speaking', function () {
|
||||
_this.session.emitEvent('publisherStartSpeaking', [new PublisherSpeakingEvent_1.PublisherSpeakingEvent(_this.session, 'publisherStartSpeaking', _this.connection, _this.streamId)]);
|
||||
});
|
||||
this.speechEvent.on('stopped_speaking', function () {
|
||||
_this.session.emitEvent('publisherStopSpeaking', [new PublisherSpeakingEvent_1.PublisherSpeakingEvent(_this.session, 'publisherStopSpeaking', _this.connection, _this.streamId)]);
|
||||
});
|
||||
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
|
||||
|
@ -386,21 +408,87 @@ var Stream = /** @class */ (function () {
|
|||
Stream.prototype.enableOnceSpeakingEvents = function () {
|
||||
var _this = this;
|
||||
this.setSpeechEventIfNotExists();
|
||||
this.speechEvent.on('speaking', function () {
|
||||
_this.session.emitEvent('publisherStartSpeaking', [new PublisherSpeakingEvent_1.PublisherSpeakingEvent(_this.session, 'publisherStartSpeaking', _this.connection, _this.streamId)]);
|
||||
_this.disableSpeakingEvents();
|
||||
});
|
||||
this.speechEvent.on('stopped_speaking', function () {
|
||||
_this.session.emitEvent('publisherStopSpeaking', [new PublisherSpeakingEvent_1.PublisherSpeakingEvent(_this.session, 'publisherStopSpeaking', _this.connection, _this.streamId)]);
|
||||
_this.disableSpeakingEvents();
|
||||
});
|
||||
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 () {
|
||||
this.speechEvent.stop();
|
||||
this.speechEvent = undefined;
|
||||
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
|
||||
|
@ -474,7 +562,7 @@ var Stream = /** @class */ (function () {
|
|||
}
|
||||
}
|
||||
else {
|
||||
_this.webRtcPeer.processAnswer(response.sdpAnswer)
|
||||
_this.webRtcPeer.processAnswer(response.sdpAnswer, false)
|
||||
.then(function () {
|
||||
_this.streamId = response.id;
|
||||
_this.isLocalStreamPublished = true;
|
||||
|
@ -530,7 +618,16 @@ var Stream = /** @class */ (function () {
|
|||
reject(new Error('Error on recvVideoFrom: ' + JSON.stringify(error)));
|
||||
}
|
||||
else {
|
||||
_this.webRtcPeer.processAnswer(response.sdpAnswer).then(function () {
|
||||
// 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();
|
||||
|
@ -550,17 +647,21 @@ var Stream = /** @class */ (function () {
|
|||
});
|
||||
};
|
||||
Stream.prototype.remotePeerSuccessfullyEstablished = function () {
|
||||
/*this.mediaStream = new MediaStream();
|
||||
|
||||
let receiver: RTCRtpReceiver;
|
||||
for (receiver of this.webRtcPeer.pc.getReceivers()) {
|
||||
if (!!receiver.track) {
|
||||
this.mediaStream.addTrack(receiver.track);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
var pc2 = this.webRtcPeer.pc;
|
||||
console.warn("GET REMOTE STREAMS", pc2.getRemoteStreams());
|
||||
this.mediaStream = pc2.getRemoteStreams()[0];
|
||||
}
|
||||
console.debug('Peer remote stream', this.mediaStream);
|
||||
if (!!this.mediaStream) {
|
||||
this.ee.emitEvent('mediastream-updated');
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -20,6 +20,8 @@ var StreamManagerEvent_1 = require("../OpenViduInternal/Events/StreamManagerEven
|
|||
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
|
||||
|
@ -64,6 +66,9 @@ var StreamManager = /** @class */ (function () {
|
|||
video: document.createElement('video'),
|
||||
id: ''
|
||||
};
|
||||
if (platform.name === 'Safari') {
|
||||
this.firstVideoElement.video.setAttribute('playsinline', 'true');
|
||||
}
|
||||
this.targetElement = targEl;
|
||||
this.element = targEl;
|
||||
}
|
||||
|
@ -83,7 +88,7 @@ var StreamManager = /** @class */ (function () {
|
|||
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)]);
|
||||
_this.ee.emitEvent('streamPlaying', [new StreamManagerEvent_1.StreamManagerEvent(_this, 'streamPlaying', undefined)]);
|
||||
};
|
||||
}
|
||||
/**
|
||||
|
@ -112,10 +117,13 @@ var StreamManager = /** @class */ (function () {
|
|||
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)]);
|
||||
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;
|
||||
};
|
||||
/**
|
||||
|
@ -142,10 +150,13 @@ var StreamManager = /** @class */ (function () {
|
|||
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)]);
|
||||
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;
|
||||
};
|
||||
/**
|
||||
|
@ -158,6 +169,9 @@ var StreamManager = /** @class */ (function () {
|
|||
else {
|
||||
this.ee.off(type, handler);
|
||||
}
|
||||
if (type === 'streamAudioVolumeChange') {
|
||||
this.stream.disableVolumeChangeEvent();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
/**
|
||||
|
@ -270,6 +284,9 @@ var StreamManager = /** @class */ (function () {
|
|||
}
|
||||
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
|
||||
|
@ -342,11 +359,13 @@ var StreamManager = /** @class */ (function () {
|
|||
StreamManager.prototype.updateMediaStream = function (mediaStream) {
|
||||
this.videos.forEach(function (streamManagerVideo) {
|
||||
streamManagerVideo.video.srcObject = mediaStream;
|
||||
console.warn("document.getElementID");
|
||||
var videoDiv = document.getElementById('remoteVideo');
|
||||
if (videoDiv) {
|
||||
streamManagerVideo.video.setAttribute('playsinline', 'true');
|
||||
videoDiv.appendChild(streamManagerVideo.video);
|
||||
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;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -364,8 +383,10 @@ var StreamManager = /** @class */ (function () {
|
|||
}
|
||||
};
|
||||
StreamManager.prototype.mirrorVideo = function (video) {
|
||||
video.style.transform = 'rotateY(180deg)';
|
||||
video.style.webkitTransform = 'rotateY(180deg)';
|
||||
if (!platform['isIonicIos']) {
|
||||
video.style.transform = 'rotateY(180deg)';
|
||||
video.style.webkitTransform = 'rotateY(180deg)';
|
||||
}
|
||||
};
|
||||
StreamManager.prototype.removeMirrorVideo = function (video) {
|
||||
video.style.transform = 'unset';
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -21,7 +21,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; }
|
||||
|
|
|
@ -12,14 +12,14 @@ export declare class ConnectionEvent extends Event {
|
|||
*/
|
||||
connection: Connection;
|
||||
/**
|
||||
* For 'connectionDestroyed' event:
|
||||
* 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' empty string
|
||||
* For `connectionCreated` event an empty string
|
||||
*/
|
||||
reason: string;
|
||||
/**
|
||||
|
|
|
@ -21,7 +21,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; }
|
||||
|
|
|
@ -21,7 +21,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; }
|
||||
|
|
|
@ -21,7 +21,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; }
|
||||
|
|
|
@ -21,7 +21,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; }
|
||||
|
|
|
@ -21,7 +21,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; }
|
||||
|
|
|
@ -21,7 +21,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; }
|
||||
|
|
|
@ -21,7 +21,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; }
|
||||
|
|
|
@ -2,13 +2,25 @@ import { Event } from './Event';
|
|||
import { StreamManager } from '../../OpenVidu/StreamManager';
|
||||
/**
|
||||
* Defines the following events:
|
||||
* - `streamPlaying`: dispatched by [[StreamManager]] ([[Publisher]] and [[Subscriber]])
|
||||
* - `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);
|
||||
constructor(target: StreamManager, type: string, value: Object | undefined);
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,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; }
|
||||
|
@ -32,15 +32,21 @@ exports.__esModule = true;
|
|||
var Event_1 = require("./Event");
|
||||
/**
|
||||
* Defines the following events:
|
||||
* - `streamPlaying`: dispatched by [[StreamManager]] ([[Publisher]] and [[Subscriber]])
|
||||
* - `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) {
|
||||
return _super.call(this, false, target, 'streamPlaying') || this;
|
||||
function StreamManagerEvent(target, type, value) {
|
||||
var _this = _super.call(this, false, target, type) || this;
|
||||
_this.value = value;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* @hidden
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"StreamManagerEvent.js","sourceRoot":"","sources":["../../../src/OpenViduInternal/Events/StreamManagerEvent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;AAEH,iCAAgC;AAGhC;;;GAGG;AACH;IAAwC,sCAAK;IAEzC;;OAEG;IACH,4BAAY,MAAqB;eAC7B,kBAAM,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,oCAAoC;IACpC,gDAAmB,GAAnB,cAAwB,CAAC;IAE7B,yBAAC;AAAD,CAAC,AAfD,CAAwC,aAAK,GAe5C;AAfY,gDAAkB"}
|
||||
{"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"}
|
|
@ -21,7 +21,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; }
|
||||
|
|
|
@ -21,7 +21,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; }
|
||||
|
|
|
@ -7,7 +7,7 @@ export interface WebRtcPeerConfiguration {
|
|||
onicecandidate: (event: any) => void;
|
||||
iceServers: RTCIceServer[] | undefined;
|
||||
mediaStream?: MediaStream;
|
||||
mode?: string;
|
||||
mode?: 'sendonly' | 'recvonly' | 'sendrecv';
|
||||
id?: string;
|
||||
}
|
||||
export declare class WebRtcPeer {
|
||||
|
@ -45,7 +45,7 @@ export declare class WebRtcPeer {
|
|||
* 3) Function invoked when a SDP answer is received. Final step in SDP negotiation, the peer
|
||||
* just needs to set the answer as its remote description
|
||||
*/
|
||||
processAnswer(sdpAnswer: string): Promise<string>;
|
||||
processAnswer(sdpAnswer: string, needsTimeoutOnProcessAswer: boolean): Promise<string>;
|
||||
/**
|
||||
* Callback function invoked when an ICE candidate is received
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,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; }
|
||||
|
@ -31,6 +31,8 @@ var __extends = (this && this.__extends) || (function () {
|
|||
exports.__esModule = true;
|
||||
var freeice = require("freeice");
|
||||
var uuid = require("uuid");
|
||||
var platform = require("platform");
|
||||
platform['isIonicIos'] = (platform.product === 'iPhone' || platform.product === 'iPad') && platform.ua.indexOf('Safari') === -1;
|
||||
var WebRtcPeer = /** @class */ (function () {
|
||||
function WebRtcPeer(configuration) {
|
||||
var _this = this;
|
||||
|
@ -78,13 +80,17 @@ var WebRtcPeer = /** @class */ (function () {
|
|||
reject('The peer connection object is in "closed" state. This is most likely due to an invocation of the dispose method before accepting in the dialogue');
|
||||
}
|
||||
if (!!_this.configuration.mediaStream) {
|
||||
for (var _i = 0, _a = _this.configuration.mediaStream.getTracks(); _i < _a.length; _i++) {
|
||||
var track = _a[_i];
|
||||
//this.pc.addTrack(track, this.configuration.mediaStream);
|
||||
console.warn("ADDSTREAM");
|
||||
if (platform['isIonicIos']) {
|
||||
// iOS Ionic. LIMITATION: must use deprecated WebRTC API
|
||||
var pc2 = _this.pc;
|
||||
pc2.addStream(_this.configuration.mediaStream);
|
||||
}
|
||||
else {
|
||||
for (var _i = 0, _a = _this.configuration.mediaStream.getTracks(); _i < _a.length; _i++) {
|
||||
var track = _a[_i];
|
||||
_this.pc.addTrack(track, _this.configuration.mediaStream);
|
||||
}
|
||||
}
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
|
@ -101,20 +107,42 @@ var WebRtcPeer = /** @class */ (function () {
|
|||
}
|
||||
this.remoteCandidatesQueue = [];
|
||||
this.localCandidatesQueue = [];
|
||||
// Stop senders
|
||||
var pc1 = this.pc;
|
||||
for (var _i = 0, _a = pc1.getLocalStreams(); _i < _a.length; _i++) {
|
||||
var sender = _a[_i];
|
||||
if (!videoSourceIsMediaStreamTrack) {
|
||||
sender.stop();
|
||||
if (platform['isIonicIos']) {
|
||||
// iOS Ionic. LIMITATION: must use deprecated WebRTC API
|
||||
// Stop senders deprecated
|
||||
var pc1 = this.pc;
|
||||
for (var _i = 0, _a = pc1.getLocalStreams(); _i < _a.length; _i++) {
|
||||
var sender = _a[_i];
|
||||
if (!videoSourceIsMediaStreamTrack) {
|
||||
sender.stop();
|
||||
}
|
||||
pc1.removeStream(sender);
|
||||
}
|
||||
// Stop receivers deprecated
|
||||
for (var _b = 0, _c = pc1.getRemoteStreams(); _b < _c.length; _b++) {
|
||||
var receiver = _c[_b];
|
||||
if (!!receiver.track) {
|
||||
receiver.stop();
|
||||
}
|
||||
}
|
||||
pc1.removeStream(sender);
|
||||
}
|
||||
// Stop receivers
|
||||
for (var _b = 0, _c = pc1.getRemoteStreams(); _b < _c.length; _b++) {
|
||||
var receiver = _c[_b];
|
||||
if (!!receiver.track) {
|
||||
receiver.stop();
|
||||
else {
|
||||
// Stop senders
|
||||
for (var _d = 0, _e = this.pc.getSenders(); _d < _e.length; _d++) {
|
||||
var sender = _e[_d];
|
||||
if (!videoSourceIsMediaStreamTrack) {
|
||||
if (!!sender.track) {
|
||||
sender.track.stop();
|
||||
}
|
||||
}
|
||||
this.pc.removeTrack(sender);
|
||||
}
|
||||
// Stop receivers
|
||||
for (var _f = 0, _g = this.pc.getReceivers(); _f < _g.length; _f++) {
|
||||
var receiver = _g[_f];
|
||||
if (!!receiver.track) {
|
||||
receiver.track.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
this.pc.close();
|
||||
|
@ -144,19 +172,50 @@ var WebRtcPeer = /** @class */ (function () {
|
|||
offerToReceiveVideo: (_this.configuration.mode !== 'sendonly' && offerVideo)
|
||||
};
|
||||
console.debug('RTCPeerConnection constraints: ' + JSON.stringify(constraints));
|
||||
_this.pc.createOffer(constraints).then(function (offer) {
|
||||
console.debug('Created SDP offer');
|
||||
return _this.pc.setLocalDescription(offer);
|
||||
}).then(function () {
|
||||
var localDescription = _this.pc.localDescription;
|
||||
if (!!localDescription) {
|
||||
console.debug('Local description set', localDescription.sdp);
|
||||
resolve(localDescription.sdp);
|
||||
if (platform.name === 'Safari' && platform.ua.indexOf('Safari') !== -1) {
|
||||
// Safari (excluding Ionic), at least on iOS just seems to support unified plan, whereas in other browsers is not yet ready and considered experimental
|
||||
if (offerAudio) {
|
||||
_this.pc.addTransceiver('audio', {
|
||||
direction: _this.configuration.mode
|
||||
});
|
||||
}
|
||||
else {
|
||||
reject('Local description is not defined');
|
||||
if (offerVideo) {
|
||||
_this.pc.addTransceiver('video', {
|
||||
direction: _this.configuration.mode
|
||||
});
|
||||
}
|
||||
})["catch"](function (error) { return reject(error); });
|
||||
_this.pc
|
||||
.createOffer()
|
||||
.then(function (offer) {
|
||||
console.debug('Created SDP offer');
|
||||
return _this.pc.setLocalDescription(offer);
|
||||
})
|
||||
.then(function () {
|
||||
var localDescription = _this.pc.localDescription;
|
||||
if (!!localDescription) {
|
||||
console.debug('Local description set', localDescription.sdp);
|
||||
resolve(localDescription.sdp);
|
||||
}
|
||||
else {
|
||||
reject('Local description is not defined');
|
||||
}
|
||||
})["catch"](function (error) { return reject(error); });
|
||||
}
|
||||
else {
|
||||
_this.pc.createOffer(constraints).then(function (offer) {
|
||||
console.debug('Created SDP offer');
|
||||
return _this.pc.setLocalDescription(offer);
|
||||
}).then(function () {
|
||||
var localDescription = _this.pc.localDescription;
|
||||
if (!!localDescription) {
|
||||
console.debug('Local description set', localDescription.sdp);
|
||||
resolve(localDescription.sdp);
|
||||
}
|
||||
else {
|
||||
reject('Local description is not defined');
|
||||
}
|
||||
})["catch"](function (error) { return reject(error); });
|
||||
}
|
||||
});
|
||||
};
|
||||
/**
|
||||
|
@ -196,7 +255,7 @@ var WebRtcPeer = /** @class */ (function () {
|
|||
* 3) Function invoked when a SDP answer is received. Final step in SDP negotiation, the peer
|
||||
* just needs to set the answer as its remote description
|
||||
*/
|
||||
WebRtcPeer.prototype.processAnswer = function (sdpAnswer) {
|
||||
WebRtcPeer.prototype.processAnswer = function (sdpAnswer, needsTimeoutOnProcessAswer) {
|
||||
var _this = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
var answer = {
|
||||
|
@ -207,7 +266,15 @@ var WebRtcPeer = /** @class */ (function () {
|
|||
if (_this.pc.signalingState === 'closed') {
|
||||
reject('RTCPeerConnection is closed');
|
||||
}
|
||||
_this.pc.setRemoteDescription(answer).then(function () { return resolve(); })["catch"](function (error) { return reject(error); });
|
||||
if (needsTimeoutOnProcessAswer && platform['isIonicIos']) {
|
||||
setTimeout(function () {
|
||||
console.info('setRemoteDescription run after timout for iOS device');
|
||||
_this.pc.setRemoteDescription(answer).then(function () { return resolve(); })["catch"](function (error) { return reject(error); });
|
||||
}, 250);
|
||||
}
|
||||
else {
|
||||
_this.pc.setRemoteDescription(answer).then(function () { return resolve(); })["catch"](function (error) { return reject(error); });
|
||||
}
|
||||
});
|
||||
};
|
||||
/**
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -57,7 +57,7 @@ var WebRtcStats = /** @class */ (function () {
|
|||
WebRtcStats.prototype.initWebRtcStats = function () {
|
||||
var _this = this;
|
||||
var elastestInstrumentation = localStorage.getItem('elastest-instrumentation');
|
||||
if (elastestInstrumentation) {
|
||||
if (!!elastestInstrumentation) {
|
||||
// ElasTest instrumentation object found in local storage
|
||||
console.warn('WebRtc stats enabled for stream ' + this.stream.streamId + ' of connection ' + this.stream.connection.connectionId);
|
||||
this.webRtcStatsEnabled = true;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "openvidu-browser",
|
||||
"version": "2.6.0",
|
||||
"version": "2.7.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -43,5 +43,5 @@
|
|||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"types": "lib/index.d.ts",
|
||||
"version": "2.6.0"
|
||||
"version": "2.7.0"
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -12,7 +12,7 @@
|
|||
<packaging>jar</packaging>
|
||||
|
||||
<name>OpenVidu Server</name>
|
||||
<version>2.6.0</version>
|
||||
<version>2.7.0</version>
|
||||
<description>OpenVidu Server</description>
|
||||
<url>https://github.com/OpenVidu/openvidu</url>
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -14,7 +14,7 @@
|
|||
"@angular/router": "7.1.3",
|
||||
"core-js": "2.6.0",
|
||||
"hammerjs": "2.0.8",
|
||||
"openvidu-browser": "2.6.0",
|
||||
"openvidu-browser": "2.7.0",
|
||||
"rxjs": "6.3.3",
|
||||
"zone.js": "0.8.26"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
wolfy87-eventemitter
|
||||
Unlicense
|
||||
|
||||
openvidu-browser
|
||||
Apache-2.0
|
||||
Apache License
|
||||
|
@ -206,6 +203,55 @@ Apache-2.0
|
|||
limitations under the License.
|
||||
|
||||
|
||||
platform
|
||||
MIT
|
||||
Copyright 2014-2018 Benjamin Tan <https://demoneaux.github.io/>
|
||||
Copyright 2011-2013 John-David Dalton <http://allyoucanleet.com/>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
webpack
|
||||
MIT
|
||||
Copyright JS Foundation and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
tslib
|
||||
Apache-2.0
|
||||
Apache License
|
||||
|
@ -296,55 +342,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||
SOFTWARE.
|
||||
|
||||
|
||||
platform
|
||||
MIT
|
||||
Copyright 2014-2018 Benjamin Tan <https://demoneaux.github.io/>
|
||||
Copyright 2011-2013 John-David Dalton <http://allyoucanleet.com/>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
webpack
|
||||
MIT
|
||||
Copyright JS Foundation and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
hammerjs
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
@ -370,6 +367,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
|
||||
|
||||
wolfy87-eventemitter
|
||||
Unlicense
|
||||
|
||||
hark
|
||||
MIT
|
||||
|
||||
|
@ -627,9 +627,6 @@ Apache-2.0
|
|||
|
||||
|
||||
|
||||
@angular/compiler
|
||||
MIT
|
||||
|
||||
@angular/core
|
||||
MIT
|
||||
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
|
||||
crossorigin="anonymous"></script>
|
||||
|
||||
<link rel="stylesheet" href="styles.3c42cbf6ef67a1bc9d17.css"></head>
|
||||
<link rel="stylesheet" href="styles.096dd62fdaea80b95567.css"></head>
|
||||
|
||||
<body>
|
||||
<app-root>
|
||||
<mat-spinner></mat-spinner>
|
||||
</app-root>
|
||||
<script type="text/javascript" src="runtime.ec2944dd8b20ec099bf3.js"></script><script type="text/javascript" src="polyfills.a3731fd9d2797873ec38.js"></script><script type="text/javascript" src="main.de545a73be053d734497.js"></script></body>
|
||||
<script type="text/javascript" src="runtime.ec2944dd8b20ec099bf3.js"></script><script type="text/javascript" src="polyfills.7a6ddec22ac0ed842927.js"></script><script type="text/javascript" src="main.776524b58cb43c706ecd.js"></script></body>
|
||||
|
||||
</html>
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -15,7 +15,7 @@
|
|||
"colormap": "2.3.0",
|
||||
"core-js": "2.6.0",
|
||||
"hammerjs": "2.0.8",
|
||||
"openvidu-browser": "^2.6.0",
|
||||
"openvidu-browser": "2.7.0",
|
||||
"openvidu-node-client": "2.5.0",
|
||||
"rxjs": "6.3.3",
|
||||
"zone.js": "0.8.26"
|
||||
|
@ -44,5 +44,5 @@
|
|||
"start": "ng serve",
|
||||
"test": "ng test"
|
||||
},
|
||||
"version": "2.6.0"
|
||||
"version": "2.7.0"
|
||||
}
|
Loading…
Reference in New Issue