connectycube
Advanced tools
Comparing version 3.9.2 to 3.10.0
@@ -443,3 +443,3 @@ const Config = require('../cubeConfig'), | ||
const messageStanza = ChatUtils.createMessageStanza(stanzaParams); | ||
let messageStanza = ChatUtils.createMessageStanza(stanzaParams); | ||
@@ -466,2 +466,6 @@ messageStanza | ||
if (params.extension) { | ||
messageStanza = ChatUtils.filledExtraParams(messageStanza, params.extension); | ||
} | ||
this.xmppClient.send(messageStanza); | ||
@@ -664,3 +668,4 @@ } | ||
dialogId, | ||
userId); | ||
userId, | ||
extraParamsParsed ? extraParamsParsed.extension : null); | ||
} | ||
@@ -667,0 +672,0 @@ return true; |
@@ -14,8 +14,14 @@ const Utils = require('../cubeInternalUtils'), | ||
isNumeric(value) { | ||
return /^-?\d+$/.test(value) || /^\d+\.\d+$/.test(value); | ||
} | ||
jidOrUserId(jidOrUserId) { | ||
let jid; | ||
if (typeof jidOrUserId === 'string') { // jid | ||
jid = jidOrUserId.includes('@') | ||
? jidOrUserId | ||
: this.getRoomJidFromDialogId(jidOrUserId); | ||
jid = this.isNumeric(jidOrUserId) | ||
? this.getUserJid(jidOrUserId) | ||
: jidOrUserId.includes('@') | ||
? jidOrUserId | ||
: this.getRoomJidFromDialogId(jidOrUserId); | ||
} else { // user id | ||
@@ -30,7 +36,9 @@ jid = this.getUserJid(jidOrUserId); | ||
if (typeof jidOrUserId === 'string') { | ||
chatType = jidOrUserId.includes('@') | ||
? jidOrUserId.includes('muc') | ||
? 'groupchat' | ||
: 'chat' | ||
: 'groupchat'; | ||
chatType = this.isNumeric(jidOrUserId) | ||
? 'chat' | ||
: jidOrUserId.includes('@') | ||
? jidOrUserId.includes('muc') | ||
? 'groupchat' | ||
: 'chat' | ||
:'groupchat'; | ||
} else if (typeof jidOrUserId === 'number') { | ||
@@ -37,0 +45,0 @@ chatType = 'chat'; |
@@ -175,4 +175,6 @@ const Utils = require('../cubeInternalUtils'); | ||
stopLocalStreamTracks(isIgnoreAudioTrack = false) { | ||
const isReactNative = Utils.getEnv().reactnative; | ||
this.localStream.getTracks().forEach(track => { | ||
if (isIgnoreAudioTrack && track.kind === CALL_TYPES.AUDIO) { | ||
if ((isIgnoreAudioTrack || isReactNative) && track.kind === CALL_TYPES.AUDIO) { | ||
return | ||
@@ -186,3 +188,2 @@ } else { | ||
getDisplayMedia(mediaParams, isUpdateCurrentStream = false) { | ||
if (!mediaDevices.getDisplayMedia) { | ||
@@ -193,4 +194,5 @@ throw new Error("Your browser/environment does not support 'getDisplayMedia' API") | ||
const elementId = mediaParams.elementId | ||
const attachStreamOptions = mediaParams.options | ||
delete mediaParams.elementId | ||
const attachStreamOptions = mediaParams.options | ||
delete mediaParams.options | ||
@@ -226,4 +228,5 @@ | ||
const elementId = mediaParams.elementId | ||
const attachStreamOptions = mediaParams.options | ||
delete mediaParams.elementId | ||
const attachStreamOptions = mediaParams.options | ||
delete mediaParams.options | ||
@@ -247,3 +250,4 @@ | ||
prevAudioMuteState, | ||
prevVideoMuteState | ||
prevVideoMuteState, | ||
false, | ||
) | ||
@@ -254,3 +258,3 @@ }) | ||
updateStream( | ||
stream, | ||
newStream, | ||
mediaParams, | ||
@@ -262,7 +266,8 @@ updateCurrentStream, | ||
prevVideoMuteState, | ||
isNotUpdateAudioTrack = false | ||
isNotUpdateAudioTrack, | ||
) { | ||
const newStreamTracks = stream.getTracks() | ||
const isReactNative = Utils.getEnv().reactnative; | ||
if (!updateCurrentStream) { | ||
this.localStream = stream | ||
this.localStream = newStream | ||
} else { | ||
@@ -277,7 +282,11 @@ this.localStream.getTracks().forEach(track => { | ||
} | ||
this.activeAudioDeviceId = this.activeVideoDeviceId = void 0 | ||
newStreamTracks.forEach(track => { | ||
const trackSetting = (!track.getSettings || Utils.getEnv().reactnative) ? null : track.getSettings() | ||
newStream.getTracks().forEach(track => { | ||
const trackSetting = !track.getSettings ? null : track.getSettings() | ||
if (track.kind === CALL_TYPES.AUDIO && !isNotUpdateAudioTrack) { | ||
this.activeAudioDeviceId = trackSetting && trackSetting.deviceId | ||
if (updateCurrentStream) { | ||
@@ -288,2 +297,3 @@ track.enabled = !prevAudioMuteState | ||
this.activeVideoDeviceId = trackSetting && trackSetting.deviceId | ||
if (updateCurrentStream) { | ||
@@ -293,7 +303,11 @@ track.enabled = !prevVideoMuteState | ||
} | ||
if (updateCurrentStream) { | ||
const pcSenders = this.currentPublisherPC.getSenders() | ||
const sender = pcSenders.find(sender => track.kind === sender.track.kind) | ||
//update remote stream | ||
sender.replaceTrack(track) | ||
if (!isReactNative) { | ||
const pcSenders = this.currentPublisherPC.getSenders() | ||
const sender = pcSenders.find(sender => track.kind === sender.track.kind) | ||
//update remote stream | ||
sender.replaceTrack(track) | ||
} | ||
//update local stream | ||
@@ -303,5 +317,18 @@ this.localStream.addTrack(track) | ||
}) | ||
if (elementId) { | ||
this.attachMediaStream(mediaParams.elementId, this.localStream, attachStreamOptions); | ||
} | ||
if (isReactNative && updateCurrentStream) { | ||
const janusClient = this._clientConf; | ||
janusClient.videoRoomPlugin.webrtcStuff.sdpSent = false; | ||
janusClient.videoRoomPlugin.webrtcStuff.mySdp = null; | ||
janusClient.createOffer({}, { | ||
success: () => {}, | ||
error: () => {} | ||
}) | ||
} | ||
return this.localStream | ||
@@ -308,0 +335,0 @@ } |
{ | ||
"name": "connectycube", | ||
"description": "ConnectyCube chat and video chat JavaScript SDK", | ||
"version": "3.9.2", | ||
"version": "3.10.0", | ||
"homepage": "https://developers.connectycube.com/reactnative", | ||
@@ -78,3 +78,3 @@ "main": "lib/cubeMain.js", | ||
}, | ||
"gitHead": "af73538f9e22febd2e5097904c5fea930b756f8c" | ||
"gitHead": "b465c7fb82a991edc2facbd4f7535f18db03119c" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1453866
9749