nexmo-stitch
Advanced tools
Comparing version 2.1.0-canary.1 to 2.1.0
@@ -5,2 +5,34 @@ # Changelog | ||
### Breaking Changes | ||
- Screen share | ||
- `screenshareExtensionId` changed to `screenShareExtensionId` | ||
```Javascript | ||
new ConversationClient({ | ||
debug: false, | ||
screenShareExtensionId: YOUR_EXTENSION_ID | ||
}) | ||
``` | ||
- RTC stats | ||
- config params for rtcstats are now under a single object | ||
before: | ||
```javascript | ||
params.rtcstats_enabled=false | ||
params.rtcstats_url | ||
params.rtcstats_events | ||
``` | ||
now: | ||
```javascript | ||
params.rtcstats.ws_url | ||
params.rtcstats.emit_events | ||
``` | ||
### New | ||
@@ -10,3 +42,3 @@ | ||
- initialise by setting initial config: `new ConversationClient({rtcstats_events:true});` | ||
- initialise by setting initial config: `new ConversationClient({rtcstats.emit_events:true});` | ||
@@ -41,6 +73,10 @@ - listen for MOS for the Audio stream on `Application.on('rtcstats:report', data);` | ||
- initialise by setting initial config: `new ConversationClient({rtcstats_url:"wss://...", rtcstats_enabled:true});` | ||
- initialise by setting initial config: `new ConversationClient({rtcstats.ws_url:"wss://..."});` | ||
- the WebSocket should then start receiving webrtc reports every 1s (reconnect timeout: 5000ms, retries 5) not yet configurable | ||
### Known Issues | ||
- media.mute() throws error when the audio has been disabled and enabled again | ||
--- | ||
@@ -47,0 +83,0 @@ |
@@ -81,3 +81,3 @@ /* | ||
//CASE1 conversations:get:success, | ||
//CASE 1 conversations:get:success, | ||
//PATCH this responds with member[0].user_id and name | ||
@@ -84,0 +84,0 @@ |
@@ -184,3 +184,3 @@ /* | ||
_enableStatsEvents() { | ||
if (this.application.session.config && !this.application.session.config.rtcstats_events) { | ||
if (this.application.session.config && this.application.session.config.rtcstats && !this.application.session.config.rtcstats.emit_events) { | ||
return this.conversation.media._enableStatsEvents(); | ||
@@ -275,2 +275,6 @@ } | ||
_handleStatusChange(event) { | ||
// for knocking case the conversation object is not yet set in the call. We know the action is initiated from us | ||
const _isEventFromMe = (this.conversation) ? this.conversation.me.id === event.from : true; | ||
const _isOutbound = this.direction === this.CALL_DIRECTION.OUTBOUND; | ||
const _handleStatusChangeMap = { | ||
@@ -301,33 +305,19 @@ 'member:joined': () => { | ||
'member:left': () => { | ||
if (this.status === this.CALL_STATUS.STARTED || this.status === this.CALL_STATUS.RINGING) { | ||
if (this.conversation.me.id !== event.from) { | ||
if (this.status === this.CALL_STATUS.ANSWERED) { | ||
this._setStatusAndEmit(this.CALL_STATUS.COMPLETED); | ||
return Promise.resolve(); | ||
} else { | ||
if (_isEventFromMe && _isOutbound || !_isEventFromMe && !_isOutbound) { | ||
this._setStatusAndEmit(this.CALL_STATUS.UNANSWERED); | ||
return Promise.resolve(); | ||
} else { | ||
this._setStatusAndEmit(this.CALL_STATUS.REJECTED); | ||
return Promise.resolve(); | ||
} | ||
} | ||
if (this.status !== this.CALL_STATUS.ANSWERED) { | ||
if (this.conversation.me.id === event.from) { | ||
if (this.conversation.me.state === "JOINED") { | ||
this._setStatusAndEmit(this.CALL_STATUS.REJECTED); | ||
return Promise.resolve(); | ||
} else { | ||
this._setStatusAndEmit(this.CALL_STATUS.UNANSWERED); | ||
return Promise.resolve(); | ||
} | ||
} | ||
} else { | ||
this._setStatusAndEmit(this.CALL_STATUS.COMPLETED); | ||
} | ||
return Promise.resolve(); | ||
}, | ||
'member:media': () => { | ||
if (this.status !== this.CALL_STATUS.ANSWERED && event.body.audio) { | ||
if (this.conversation.me.id === event.from) { | ||
if (this.direction === this.CALL_DIRECTION.INBOUND) { | ||
this._setStatusAndEmit(this.CALL_STATUS.ANSWERED); | ||
} | ||
} else { | ||
if (this.direction === this.CALL_DIRECTION.OUTBOUND) { | ||
this._setStatusAndEmit(this.CALL_STATUS.ANSWERED); | ||
} | ||
if (!_isEventFromMe || !_isOutbound) { | ||
this._setStatusAndEmit(this.CALL_STATUS.ANSWERED); | ||
} | ||
@@ -334,0 +324,0 @@ } |
@@ -67,8 +67,13 @@ /* | ||
this.streamIndex = 0; | ||
this.rtcstats_enabled = (this.application.session.config && this.application.session.config.rtcstats_enabled); | ||
this.rtcstats_events = (this.application.session.config && this.application.session.config.rtcstats_events); | ||
this.rtcstats = {}; | ||
if (this.application.session.config && this.application.session.config.rtcstats) { | ||
this.rtcstats = { | ||
emit_events: this.application.session.config.rtcstats.emit_events, | ||
ws_url: this.application.session.config.rtcstats.ws_url | ||
} | ||
} | ||
if (this.application.session.config && this.application.session.config.screenShareExtensionId !== '') { | ||
this.rtcHelper._setScreenShareExtensionId(this.application.session.config.screenShareExtensionId); | ||
} | ||
if (this.rtcstats_enabled) { | ||
if (this.rtcstats.emit_events) { | ||
this._initStatsReporting(); | ||
@@ -97,7 +102,9 @@ } | ||
/** | ||
* Switch on the rtcStat reporting | ||
* Switch on the rtcStat reporting to the websocket connection and events | ||
* @param ws_url | ||
* @private | ||
*/ | ||
_enableStatsReporting() { | ||
this.application.session.config.rtcstats_enabled = true; | ||
_enableStatsReporting(ws_url) { | ||
this.application.session.config.rtcstats.ws_url = ws_url; | ||
this.rtcstats.ws_url = ws_url; | ||
this._initStatsReporting(); | ||
@@ -107,7 +114,8 @@ } | ||
/** | ||
* Switch on the rtcStat events | ||
* Switch on the rtc stats emit events | ||
* @private | ||
*/ | ||
_enableStatsEvents() { | ||
this.application.session.config.rtcstats_events = true; | ||
this.application.session.config.rtcstats.emit_events = true; | ||
this.rtcstats.emit_events = true; | ||
this._initStatsEvents(); | ||
@@ -117,3 +125,3 @@ } | ||
_initStatsReporting() { | ||
if (!this.rtcHelper.isNode()) { | ||
if (!this.rtcHelper.isNode() && this.application.session.config.rtcstats.ws_url) { | ||
this.rtcStats_wsConnection = new TraceWS(); | ||
@@ -126,7 +134,5 @@ this.rtcStats = new RTCStats( | ||
); | ||
if (this.application.session.config.rtcstats_url) { | ||
this.rtcStats_wsConnection.init({ | ||
rtcstatsUri: this.application.session.config.rtcstats_url | ||
}); | ||
} | ||
this.rtcStats_wsConnection.init({ | ||
rtcstatsUri: this.application.session.config.rtcstats.ws_url | ||
}); | ||
} | ||
@@ -158,3 +164,4 @@ } | ||
_disableStatsReporting() { | ||
this.application.session.config.rtcstats_enabled = false; | ||
this.application.session.config.rtcstats.ws_url = ''; | ||
this.rtcstats.ws_url = ''; | ||
this.this.rtcStats_wsConnection.disable(); | ||
@@ -168,3 +175,4 @@ } | ||
_disableStatsEvents() { | ||
this.application.session.config.rtcstats_events = false; | ||
this.application.session.config.rtcstats.emit_events = false; | ||
this.rtcstats.emit_events = false; | ||
this.rtcStats.disable(); | ||
@@ -490,4 +498,2 @@ } | ||
_handleNewOffer(params, event) { | ||
const remoteMemberObject = { | ||
@@ -1000,6 +1006,5 @@ remote_member_id: event.body.member_id, | ||
// ps.trace is injected in rtcstats module | ||
if (this.rtcstats_events) { | ||
if (this.rtcstats.emit_events) { | ||
this._initStatsEvents(); | ||
} | ||
return this._handleAudio(params) | ||
@@ -1036,3 +1041,3 @@ .then((result) => resolve(result)) | ||
}; | ||
if (this.application.session.config.iceServers) { | ||
if (this.application.session.config && this.application.session.config.iceServers) { | ||
pc_config.iceServers = this.application.session.config.iceServers | ||
@@ -1039,0 +1044,0 @@ } |
@@ -49,5 +49,5 @@ /* | ||
* @param {Boolean} params.reconnection=true socket.io reconnection attribute | ||
* @param {Boolean} params.rtcstats_enabled=false enable reporting for rtc stats | ||
* @param {string} params.rtcstats_url='' endpoint (weboscket) to send rtc stats reports | ||
* @param {Boolean} params.rtcstats_events=false receive rtcstats:report event | ||
* @param {object} params.rtcstats set reporting for stream statistics (Websocket or internal event emit) | ||
* @param {string} params.rtcstats.ws_url='' endpoint (weboscket) to send rtc stats. | ||
* @param {Boolean} params.rtcstats.emit_events=false receive rtcstats:report event | ||
* @param {Boolean} params.forceNew=true socket.io forceNew attribute | ||
@@ -80,3 +80,3 @@ * @param {Boolean} params.autoConnect=true socket.io autoConnect attribute | ||
screenShareExtensionId: '', | ||
SDK_version: '2.1.0-canary.1', | ||
SDK_version: '2.1.0', | ||
url: 'https://ws.nexmo.com', | ||
@@ -86,5 +86,6 @@ iceServers: [{ | ||
}], | ||
rtcstats_enabled: false, | ||
rtcstats_url: '', | ||
rtcstats_events: false | ||
rtcstats: { | ||
ws_url: '', | ||
emit_events: false | ||
} | ||
}; | ||
@@ -91,0 +92,0 @@ let connection; |
@@ -5,3 +5,3 @@ { | ||
"repository": "https://github.com/Nexmo/conversation-js-sdk", | ||
"version": "2.1.0-canary.1", | ||
"version": "2.1.0", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "nexmo", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1023387
2
22276
1