From 15e09b9d5b667f19fade308ef366ba566f1efa61 Mon Sep 17 00:00:00 2001 From: pabloFuente Date: Tue, 3 Jul 2018 19:13:23 +0200 Subject: [PATCH] openvidu-browser: fix when local session dispatches StreamPropertyChangedEvent --- openvidu-browser/npm-shrinkwrap.json | 30 ++++++---------------- openvidu-browser/src/OpenVidu/OpenVidu.ts | 7 +++-- openvidu-browser/src/OpenVidu/Publisher.ts | 7 +++-- 3 files changed, 14 insertions(+), 30 deletions(-) diff --git a/openvidu-browser/npm-shrinkwrap.json b/openvidu-browser/npm-shrinkwrap.json index f2b5e05c..0a47df1e 100644 --- a/openvidu-browser/npm-shrinkwrap.json +++ b/openvidu-browser/npm-shrinkwrap.json @@ -1310,14 +1310,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1332,20 +1330,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -1462,8 +1457,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -1475,7 +1469,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -1490,7 +1483,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -1498,14 +1490,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -1524,7 +1514,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -1605,8 +1594,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -1618,7 +1606,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -1740,7 +1727,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -4082,7 +4068,7 @@ "progress": "^2.0.0", "shelljs": "^0.8.1", "typedoc-default-themes": "^0.5.0", - "typescript": "2.7.2" + "typescript": "2.9.2" }, "dependencies": { "typescript": { diff --git a/openvidu-browser/src/OpenVidu/OpenVidu.ts b/openvidu-browser/src/OpenVidu/OpenVidu.ts index 3ca53bcb..0d74f458 100644 --- a/openvidu-browser/src/OpenVidu/OpenVidu.ts +++ b/openvidu-browser/src/OpenVidu/OpenVidu.ts @@ -110,21 +110,20 @@ export class OpenVidu { width: newWidth || 0, height: newHeight || 0 }; - const newValue = JSON.stringify(publisher.stream.videoDimensions); this.sendRequest( 'streamPropertyChanged', { streamId: publisher.stream.streamId, property: 'videoDimensions', - newValue, + newValue: JSON.stringify(publisher.stream.videoDimensions), reason: 'deviceRotated' }, (error, response) => { if (error) { console.error("Error sending 'streamPropertyChanged' event", error); } else { - this.session.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent(this.session, publisher.stream, 'videoDimensions', newValue, { width: oldWidth, height: oldHeight }, 'deviceRotated')]); - publisher.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent(publisher, publisher.stream, 'videoDimensions', newValue, { width: oldWidth, height: oldHeight }, 'deviceRotated')]); + this.session.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent(this.session, publisher.stream, 'videoDimensions', publisher.stream.videoDimensions, { width: oldWidth, height: oldHeight }, 'deviceRotated')]); + publisher.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent(publisher, publisher.stream, 'videoDimensions', publisher.stream.videoDimensions, { width: oldWidth, height: oldHeight }, 'deviceRotated')]); } }); clearTimeout(repeatUntilChange); diff --git a/openvidu-browser/src/OpenVidu/Publisher.ts b/openvidu-browser/src/OpenVidu/Publisher.ts index 37c5d161..cb704679 100644 --- a/openvidu-browser/src/OpenVidu/Publisher.ts +++ b/openvidu-browser/src/OpenVidu/Publisher.ts @@ -341,21 +341,20 @@ export class Publisher extends StreamManager { width: newWidth || 0, height: newHeight || 0 }; - const newValue = JSON.stringify(this.stream.videoDimensions); this.session.openvidu.sendRequest( 'streamPropertyChanged', { streamId: this.stream.streamId, property: 'videoDimensions', - newValue, + newValue: JSON.stringify(this.stream.videoDimensions), reason: 'screenResized' }, (error, response) => { if (error) { console.error("Error sending 'streamPropertyChanged' event", error); } else { - this.session.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent(this.session, this.stream, 'videoDimensions', newValue, oldValue, 'screenResized')]); - this.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent(this, this.stream, 'videoDimensions', newValue, oldValue, 'screenResized')]); + this.session.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent(this.session, this.stream, 'videoDimensions', this.stream.videoDimensions, oldValue, 'screenResized')]); + this.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent(this, this.stream, 'videoDimensions', this.stream.videoDimensions, oldValue, 'screenResized')]); } }); }