podchat-browser 12.2.1-snapshot.2 → 12.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/podchat-12.3.1.js +75155 -0
- package/examples/index.html +41 -7
- package/package.json +3 -3
- package/src/call.module.js +217 -25
- package/src/chat.js +2 -0
package/examples/index.html
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
<!--<script type="text/javascript" src="podchat-browser.min.js"></script>-->
|
|
29
29
|
|
|
30
30
|
<script type="text/javascript">
|
|
31
|
-
//
|
|
31
|
+
// Development
|
|
32
32
|
var PodChat = window.POD.Chat;
|
|
33
33
|
var env = 'main'; // main | sandbox | integration
|
|
34
34
|
|
|
@@ -963,13 +963,15 @@
|
|
|
963
963
|
* Listen to File Upload Events
|
|
964
964
|
*/
|
|
965
965
|
chatAgent.on("fileUploadEvents", function (event) {
|
|
966
|
-
console.log(event);
|
|
966
|
+
console.log("[fileUploadEvents]", event);
|
|
967
967
|
});
|
|
968
968
|
|
|
969
969
|
/**
|
|
970
970
|
* Listen to Contact Events
|
|
971
971
|
*/
|
|
972
972
|
chatAgent.on("contactEvents", function (event) {
|
|
973
|
+
console.log("[contactEvents]", event);
|
|
974
|
+
|
|
973
975
|
if (event.type == 'CONTACTS_SYNCED') {
|
|
974
976
|
console.log('Core contacts have been successfully synced with chat server.');
|
|
975
977
|
}
|
|
@@ -980,7 +982,7 @@
|
|
|
980
982
|
*/
|
|
981
983
|
chatAgent.on("threadEvents", function (event) {
|
|
982
984
|
var type = event.type;
|
|
983
|
-
console.log(event);
|
|
985
|
+
console.log("[threadEvents]", event);
|
|
984
986
|
|
|
985
987
|
switch (type) {
|
|
986
988
|
case "THREAD_LAST_ACTIVITY_TIME":
|
|
@@ -1029,7 +1031,7 @@
|
|
|
1029
1031
|
var type = event.type,
|
|
1030
1032
|
message = event.result.message;
|
|
1031
1033
|
|
|
1032
|
-
console.log(event);
|
|
1034
|
+
console.log("[messageEvents]", event);
|
|
1033
1035
|
|
|
1034
1036
|
switch (type) {
|
|
1035
1037
|
case "MESSAGE_NEW":
|
|
@@ -1071,7 +1073,7 @@
|
|
|
1071
1073
|
*/
|
|
1072
1074
|
chatAgent.on("systemEvents", function (event) {
|
|
1073
1075
|
var type = event.type;
|
|
1074
|
-
console.log(event);
|
|
1076
|
+
console.log("[systemEvents]", event);
|
|
1075
1077
|
|
|
1076
1078
|
switch (type) {
|
|
1077
1079
|
case "IS_TYPING":
|
|
@@ -1088,7 +1090,7 @@
|
|
|
1088
1090
|
*/
|
|
1089
1091
|
chatAgent.on('userEvents', function (event) {
|
|
1090
1092
|
var type = event.type;
|
|
1091
|
-
console.log(event);
|
|
1093
|
+
console.log("[userEvents]", event);
|
|
1092
1094
|
|
|
1093
1095
|
switch (type) {
|
|
1094
1096
|
case 'CHAT_PROFILE_UPDATED':
|
|
@@ -1105,7 +1107,7 @@
|
|
|
1105
1107
|
*/
|
|
1106
1108
|
chatAgent.on('callEvents', function (event) {
|
|
1107
1109
|
var type = event.type;
|
|
1108
|
-
console.log(event);
|
|
1110
|
+
console.log("[callEvents]", event);
|
|
1109
1111
|
|
|
1110
1112
|
// if (type === 'CALL_ERROR')
|
|
1111
1113
|
// debugger;
|
|
@@ -1927,6 +1929,7 @@ Thread: <input type="text" id="threadInput" autocomplete="on" width="500">
|
|
|
1927
1929
|
<label for="apList">User Id</label>
|
|
1928
1930
|
<input type="text" name="adminThreadParticipantUserId" id="adminThreadParticipantUserId" placeholder="UserId">
|
|
1929
1931
|
<button type="button" name="button" id="adminThreadParticipantBtn">Make admin</button>
|
|
1932
|
+
<button type="button" name="button" id="removeAdminThreadParticipantBtn">Remove admin</button>
|
|
1930
1933
|
</fieldset>
|
|
1931
1934
|
</form>
|
|
1932
1935
|
|
|
@@ -3268,6 +3271,37 @@ Thread: <input type="text" id="threadInput" autocomplete="on" width="500">
|
|
|
3268
3271
|
console.log("[HTML][chatAgent.setAdmin][result]", result);
|
|
3269
3272
|
})
|
|
3270
3273
|
});
|
|
3274
|
+
|
|
3275
|
+
document.getElementById("removeAdminThreadParticipantBtn").addEventListener("click", function (event){
|
|
3276
|
+
event.preventDefault();
|
|
3277
|
+
var userId = document.getElementById("adminThreadParticipantUserId").value;
|
|
3278
|
+
var threadId = document.getElementById("adminThreadParticipantThreadId").value;
|
|
3279
|
+
var rolesList = [
|
|
3280
|
+
'post_channel_message',
|
|
3281
|
+
'edit_message_of_others',
|
|
3282
|
+
'delete_message_of_others',
|
|
3283
|
+
'add_new_user',
|
|
3284
|
+
'remove_user',
|
|
3285
|
+
'thread_admin',
|
|
3286
|
+
'add_rule_to_user',
|
|
3287
|
+
'remove_role_from_user',
|
|
3288
|
+
'edit_thread',
|
|
3289
|
+
'read_thread',
|
|
3290
|
+
'ownership'
|
|
3291
|
+
];
|
|
3292
|
+
console.log("roles list: ", rolesList)
|
|
3293
|
+
chatAgent.removeAdmin({
|
|
3294
|
+
threadId: threadId,
|
|
3295
|
+
admins: [{
|
|
3296
|
+
userId: userId,
|
|
3297
|
+
roles: rolesList
|
|
3298
|
+
}],
|
|
3299
|
+
}, function (result) {
|
|
3300
|
+
console.log("[HTML][chatAgent.removeAdmin][result]", result);
|
|
3301
|
+
})
|
|
3302
|
+
});
|
|
3303
|
+
|
|
3304
|
+
|
|
3271
3305
|
</script>
|
|
3272
3306
|
|
|
3273
3307
|
</html>
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podchat-browser",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.3.1",
|
|
4
4
|
"description": "Javascript SDK to use POD's Chat Service - Browser Only",
|
|
5
5
|
"main": "./src/chat.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "mocha --reporter spec --exit",
|
|
8
|
-
"bundle": "browserify browser-bundling.js -o ./dist/podchat-12.
|
|
8
|
+
"bundle": "browserify browser-bundling.js -o ./dist/podchat-12.3.1.js",
|
|
9
9
|
"publish:snapshot": "npm run version:snapshot && npm publish --tag snapshot",
|
|
10
10
|
"version:snapshot": "npm version prerelease --preid snapshot",
|
|
11
11
|
"publish:release": "npm run version:release && npm publish",
|
|
12
|
-
"version:release": "npm version 12.
|
|
12
|
+
"version:release": "npm version 12.3.1"
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
package/src/call.module.js
CHANGED
|
@@ -14,8 +14,6 @@
|
|
|
14
14
|
WebrtcAdapter = window.adapter;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
17
|
var Utility = params.Utility,
|
|
20
18
|
currentModuleInstance = this,
|
|
21
19
|
Sentry = params.Sentry,
|
|
@@ -197,12 +195,14 @@
|
|
|
197
195
|
callMetaDataTypes = {
|
|
198
196
|
POORCONNECTION: 1,
|
|
199
197
|
POORCONNECTIONRESOLVED: 2,
|
|
200
|
-
CUSTOMUSERMETADATA: 3
|
|
198
|
+
CUSTOMUSERMETADATA: 3,
|
|
199
|
+
SCREENSHAREMETADATA: 4
|
|
201
200
|
},
|
|
202
201
|
screenShareState = {
|
|
203
202
|
started: false,
|
|
204
203
|
imOwner: false
|
|
205
204
|
},
|
|
205
|
+
screenShareInfo = new ScreenShareStateClass(),
|
|
206
206
|
callClientType = {
|
|
207
207
|
WEB: 1,
|
|
208
208
|
ANDROID: 2,
|
|
@@ -230,6 +230,58 @@
|
|
|
230
230
|
? params.asyncLogging.consoleLogging
|
|
231
231
|
: false;
|
|
232
232
|
|
|
233
|
+
function ScreenShareStateClass() {
|
|
234
|
+
var config = {
|
|
235
|
+
ownerId: 0,
|
|
236
|
+
imOwner: false,
|
|
237
|
+
isStarted: false,
|
|
238
|
+
width: callVideoMinWidth,
|
|
239
|
+
hight: callVideoMinHeight
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return {
|
|
243
|
+
setOwner: function (ownerId) {
|
|
244
|
+
config.ownerId = +ownerId;
|
|
245
|
+
},
|
|
246
|
+
setIsStarted: function (isStarted) {
|
|
247
|
+
config.isStarted = isStarted;
|
|
248
|
+
},
|
|
249
|
+
isStarted: function () {
|
|
250
|
+
return config.isStarted;
|
|
251
|
+
},
|
|
252
|
+
iAmOwner: function () {
|
|
253
|
+
return config.ownerId === chatMessaging.userInfo.id
|
|
254
|
+
},
|
|
255
|
+
setWidth: function (width) {
|
|
256
|
+
config.width = width;
|
|
257
|
+
},
|
|
258
|
+
setHeight: function (height) {
|
|
259
|
+
config.height = height;
|
|
260
|
+
},
|
|
261
|
+
getWidth: function (width) {
|
|
262
|
+
return config.width;
|
|
263
|
+
},
|
|
264
|
+
getHeight: function (height) {
|
|
265
|
+
return config.height;
|
|
266
|
+
},
|
|
267
|
+
getOwner: function () {
|
|
268
|
+
return config.ownerId
|
|
269
|
+
},
|
|
270
|
+
setDimension: function (dimension) {
|
|
271
|
+
if(dimension
|
|
272
|
+
&& dimension.width && +dimension.width > 0
|
|
273
|
+
&& dimension.height && +dimension.height > 0
|
|
274
|
+
) {
|
|
275
|
+
screenShareInfo.setHeight(dimension.height);
|
|
276
|
+
screenShareInfo.setWidth(dimension.width);
|
|
277
|
+
} else {
|
|
278
|
+
screenShareInfo.setHeight(callVideoMinHeight);
|
|
279
|
+
screenShareInfo.setWidth(callVideoMinWidth);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
233
285
|
var init = function () {
|
|
234
286
|
|
|
235
287
|
},
|
|
@@ -500,6 +552,9 @@
|
|
|
500
552
|
callStateController.setupCallParticipant(params.selfData);
|
|
501
553
|
}
|
|
502
554
|
|
|
555
|
+
screenShareInfo.setOwner(params.screenShareOwner);
|
|
556
|
+
screenShareInfo.setIsStarted(!!params.screenShareOwner);
|
|
557
|
+
|
|
503
558
|
if(params.clientsList && params.clientsList.length) {
|
|
504
559
|
for(var i in params.clientsList) {
|
|
505
560
|
if(params.clientsList[i].userId !== chatMessaging.userInfo.id)
|
|
@@ -570,7 +625,7 @@
|
|
|
570
625
|
startCall: function (params) {
|
|
571
626
|
var callController = this;
|
|
572
627
|
for(var i in callUsers) {
|
|
573
|
-
if(i === 'screenShare')
|
|
628
|
+
if(i === 'screenShare' && !screenShareInfo.isStarted())
|
|
574
629
|
continue;
|
|
575
630
|
|
|
576
631
|
if(callUsers[i].video) {
|
|
@@ -617,7 +672,7 @@
|
|
|
617
672
|
};
|
|
618
673
|
obj.topicMetaData = {};
|
|
619
674
|
obj.peers = {};
|
|
620
|
-
if(
|
|
675
|
+
if(screenShareInfo.iAmOwner()) {
|
|
621
676
|
obj.direction = 'send';
|
|
622
677
|
} else {
|
|
623
678
|
obj.direction = 'receive'
|
|
@@ -632,7 +687,10 @@
|
|
|
632
687
|
isConnectionPoor: false
|
|
633
688
|
};
|
|
634
689
|
callUsers['screenShare'] = obj;
|
|
635
|
-
|
|
690
|
+
if(screenShareInfo.isStarted())
|
|
691
|
+
this.appendUserToCallDiv('screenShare', this.generateHTMLElements('screenShare'));
|
|
692
|
+
else
|
|
693
|
+
this.generateHTMLElements('screenShare')
|
|
636
694
|
},
|
|
637
695
|
appendUserToCallDiv: function (userId) {
|
|
638
696
|
if(!callDivId) {
|
|
@@ -1179,9 +1237,9 @@
|
|
|
1179
1237
|
}
|
|
1180
1238
|
},
|
|
1181
1239
|
removeScreenShareFromCall: function (topic) {
|
|
1182
|
-
var
|
|
1183
|
-
|
|
1184
|
-
if(screenShare.peers[screenShare.videoTopicName]) {
|
|
1240
|
+
var screenShare = callUsers["screenShare"];
|
|
1241
|
+
|
|
1242
|
+
if(screenShare && screenShare.peers[screenShare.videoTopicName]) {
|
|
1185
1243
|
callStateController.removeStreamFromWebRTC('screenShare', screenShare.videoTopicName)
|
|
1186
1244
|
callStateController.removeTopic('screenShare', screenShare.videoTopicName);
|
|
1187
1245
|
chatEvents.fireEvent('callEvents', {
|
|
@@ -1639,8 +1697,59 @@
|
|
|
1639
1697
|
content: jMessage.content
|
|
1640
1698
|
});
|
|
1641
1699
|
break;
|
|
1700
|
+
case callMetaDataTypes.SCREENSHAREMETADATA:
|
|
1701
|
+
screenShareInfo.setWidth(jMessage.content.dimension.width);
|
|
1702
|
+
screenShareInfo.setHeight(jMessage.content.dimension.height);
|
|
1703
|
+
applyScreenShareSizeToElement();
|
|
1704
|
+
chatEvents.fireEvent("callEvents", {
|
|
1705
|
+
type: 'SCREENSHARE_METADATA',
|
|
1706
|
+
userId: jMessage.userid,
|
|
1707
|
+
content: jMessage.content
|
|
1708
|
+
});
|
|
1709
|
+
break;
|
|
1642
1710
|
}
|
|
1643
1711
|
|
|
1712
|
+
},
|
|
1713
|
+
|
|
1714
|
+
applyScreenShareSizeToElement = function () {
|
|
1715
|
+
var videoElement = callUsers['screenShare'].htmlElements[callUsers['screenShare'].videoTopicName];
|
|
1716
|
+
let videoTrack = videoElement.srcObject.getTracks()[0];
|
|
1717
|
+
|
|
1718
|
+
if (navigator && !!navigator.userAgent.match(/firefox/gi)) {
|
|
1719
|
+
videoTrack.enable = false;
|
|
1720
|
+
let newWidth = callVideoMinWidth - (Math.ceil(Math.random() * 50) + 20);
|
|
1721
|
+
let newHeight = callVideoMinHeight - (Math.ceil(Math.random() * 50) + 20);
|
|
1722
|
+
|
|
1723
|
+
videoTrack.applyConstraints({
|
|
1724
|
+
advanced: [
|
|
1725
|
+
{
|
|
1726
|
+
width: screenShareInfo.getWidth(),
|
|
1727
|
+
height: screenShareInfo.getHeight()
|
|
1728
|
+
},
|
|
1729
|
+
{
|
|
1730
|
+
aspectRatio: 1.333
|
|
1731
|
+
}
|
|
1732
|
+
]
|
|
1733
|
+
}).then((res) => {
|
|
1734
|
+
videoTrack.enabled = true;
|
|
1735
|
+
setTimeout(() => {
|
|
1736
|
+
videoTrack.applyConstraints({
|
|
1737
|
+
"width": screenShareInfo.getWidth(),
|
|
1738
|
+
"height": screenShareInfo.getHeight()
|
|
1739
|
+
});
|
|
1740
|
+
}, 500);
|
|
1741
|
+
}).catch(e => consoleLogging && console.log(e));
|
|
1742
|
+
} else {
|
|
1743
|
+
videoTrack.applyConstraints({
|
|
1744
|
+
"width": screenShareInfo.getWidth() - (Math.ceil(Math.random() * 5) + 5)
|
|
1745
|
+
}).then((res) => {
|
|
1746
|
+
setTimeout(function () {
|
|
1747
|
+
videoTrack.applyConstraints({
|
|
1748
|
+
"width": screenShareInfo.getWidth()
|
|
1749
|
+
});
|
|
1750
|
+
}, 500);
|
|
1751
|
+
}).catch(e => consoleLogging && console.log(e));
|
|
1752
|
+
}
|
|
1644
1753
|
}
|
|
1645
1754
|
|
|
1646
1755
|
|
|
@@ -1680,8 +1789,9 @@
|
|
|
1680
1789
|
}
|
|
1681
1790
|
if(callUsers && callUsers['screenShare']
|
|
1682
1791
|
&& callUsers['screenShare'].video
|
|
1683
|
-
&&
|
|
1684
|
-
&&
|
|
1792
|
+
&& screenShareInfo.isStarted()
|
|
1793
|
+
&& screenShareInfo.iAmOwner()
|
|
1794
|
+
) {
|
|
1685
1795
|
restartMediaOnKeyFrame('screenShare', [2000,4000,8000,12000]);
|
|
1686
1796
|
}
|
|
1687
1797
|
break;
|
|
@@ -1882,7 +1992,9 @@
|
|
|
1882
1992
|
turnAddress: messageContent.chatDataDto.turnAddress,
|
|
1883
1993
|
internalTurnAddress: messageContent.chatDataDto.internalTurnAddress,
|
|
1884
1994
|
selfData: messageContent.clientDTO,
|
|
1885
|
-
clientsList: messageContent.otherClientDtoList
|
|
1995
|
+
clientsList: messageContent.otherClientDtoList,
|
|
1996
|
+
screenShareOwner: +messageContent.chatDataDto.screenShareUser,
|
|
1997
|
+
recordingOwner: +messageContent.chatDataDto.recordingUser
|
|
1886
1998
|
}, function (callDivs) {
|
|
1887
1999
|
chatEvents.fireEvent('callEvents', {
|
|
1888
2000
|
type: 'CALL_DIVS',
|
|
@@ -2022,6 +2134,8 @@
|
|
|
2022
2134
|
if (!!messageContent[0].userId) {
|
|
2023
2135
|
//callStateController.removeFromCallUI(messageContent[0].sendTopic)
|
|
2024
2136
|
callStateController.removeParticipant(messageContent[0].userId);
|
|
2137
|
+
if(screenShareInfo.getOwner() === messageContent[0].userId)
|
|
2138
|
+
callStateController.removeScreenShareFromCall()
|
|
2025
2139
|
}
|
|
2026
2140
|
|
|
2027
2141
|
//If I'm the only call participant, stop the call
|
|
@@ -2084,8 +2198,19 @@
|
|
|
2084
2198
|
}
|
|
2085
2199
|
if(callUsers && callUsers['screenShare']
|
|
2086
2200
|
&& callUsers['screenShare'].video
|
|
2087
|
-
&&
|
|
2088
|
-
&&
|
|
2201
|
+
&& screenShareInfo.isStarted()
|
|
2202
|
+
&& screenShareInfo.iAmOwner()
|
|
2203
|
+
) {
|
|
2204
|
+
sendCallMetaData({
|
|
2205
|
+
id: callMetaDataTypes.SCREENSHAREMETADATA,
|
|
2206
|
+
userid: chatMessaging.userInfo.id,
|
|
2207
|
+
content: {
|
|
2208
|
+
dimension: {
|
|
2209
|
+
width: screenShareInfo.getWidth(),
|
|
2210
|
+
height: screenShareInfo.getHeight()
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
});
|
|
2089
2214
|
restartMediaOnKeyFrame('screenShare', [2000, 4000, 8000, 12000, 16000, 24000]);
|
|
2090
2215
|
}
|
|
2091
2216
|
|
|
@@ -2339,16 +2464,17 @@
|
|
|
2339
2464
|
if(!callRequestController.callEstablishedInMySide)
|
|
2340
2465
|
return;
|
|
2341
2466
|
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2467
|
+
screenShareInfo.setIsStarted(true);
|
|
2468
|
+
screenShareInfo.setOwner(messageContent.screenOwner.id);
|
|
2469
|
+
/*if(messageContent.screenOwner.id === chatMessaging.userInfo.id) {
|
|
2470
|
+
screenShareInfo.setIAmOwner(true);
|
|
2345
2471
|
} else {
|
|
2346
|
-
|
|
2347
|
-
}
|
|
2472
|
+
screenShareInfo.setIAmOwner(false);
|
|
2473
|
+
}*/
|
|
2348
2474
|
|
|
2349
2475
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
2350
2476
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
2351
|
-
} else if(!
|
|
2477
|
+
} else if(!screenShareInfo.iAmOwner()) {
|
|
2352
2478
|
callStateController.addScreenShareToCall("receive", false)
|
|
2353
2479
|
}
|
|
2354
2480
|
|
|
@@ -2363,12 +2489,12 @@
|
|
|
2363
2489
|
* Type 124 End Screen Share
|
|
2364
2490
|
*/
|
|
2365
2491
|
case chatMessageVOTypes.END_SCREEN_SHARE:
|
|
2366
|
-
|
|
2367
|
-
|
|
2492
|
+
// screenShareInfo.setIAmOwner(false);
|
|
2493
|
+
screenShareInfo.setIsStarted(false);
|
|
2368
2494
|
|
|
2369
2495
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
2370
2496
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
2371
|
-
} else if (!
|
|
2497
|
+
} else if (!screenShareInfo.iAmOwner()) {
|
|
2372
2498
|
consoleLogging && console.log("[SDK][END_SCREEN_SHARE], im not owner of screen");
|
|
2373
2499
|
callStateController.removeScreenShareFromCall();
|
|
2374
2500
|
}
|
|
@@ -2477,6 +2603,13 @@
|
|
|
2477
2603
|
}
|
|
2478
2604
|
}
|
|
2479
2605
|
|
|
2606
|
+
if(params.threadInfo
|
|
2607
|
+
&& (params.threadInfo.metadata
|
|
2608
|
+
|| params.threadInfo.uniqueName)
|
|
2609
|
+
) {
|
|
2610
|
+
content.createCallThreadRequest = params.threadInfo
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2480
2613
|
startCallData.content = JSON.stringify(content);
|
|
2481
2614
|
} else {
|
|
2482
2615
|
chatEvents.fireEvent('error', {
|
|
@@ -2545,6 +2678,15 @@
|
|
|
2545
2678
|
}
|
|
2546
2679
|
}
|
|
2547
2680
|
|
|
2681
|
+
if(params.threadInfo
|
|
2682
|
+
&& (params.threadInfo.title
|
|
2683
|
+
|| params.threadInfo.description
|
|
2684
|
+
|| params.threadInfo.metadata
|
|
2685
|
+
|| params.threadInfo.uniqueName)
|
|
2686
|
+
) {
|
|
2687
|
+
content.createCallThreadRequest = params.threadInfo
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2548
2690
|
startCallData.content = JSON.stringify(content);
|
|
2549
2691
|
} else {
|
|
2550
2692
|
chatEvents.fireEvent('error', {
|
|
@@ -2644,6 +2786,11 @@
|
|
|
2644
2786
|
}
|
|
2645
2787
|
|
|
2646
2788
|
acceptCallData.content = JSON.stringify(content);
|
|
2789
|
+
|
|
2790
|
+
if(params.joinCall) {
|
|
2791
|
+
callRequestController.callRequestReceived = true;
|
|
2792
|
+
currentCallId = params.callId;
|
|
2793
|
+
}
|
|
2647
2794
|
} else {
|
|
2648
2795
|
chatEvents.fireEvent('error', {
|
|
2649
2796
|
code: 999,
|
|
@@ -2810,10 +2957,27 @@
|
|
|
2810
2957
|
consoleLogging && console.log("[sdk][startScreenShare][onResult]: ", result);
|
|
2811
2958
|
if(!result.hasError) {
|
|
2812
2959
|
var direction = 'send', shareScreen = true;
|
|
2813
|
-
|
|
2960
|
+
|
|
2961
|
+
if(screenShareInfo.isStarted() && !screenShareInfo.iAmOwner()){
|
|
2814
2962
|
direction = 'receive';
|
|
2815
2963
|
shareScreen = false;
|
|
2816
2964
|
}
|
|
2965
|
+
|
|
2966
|
+
if(screenShareInfo.isStarted() && screenShareInfo.iAmOwner()) {
|
|
2967
|
+
screenShareInfo.setWidth(callVideoMinWidth);
|
|
2968
|
+
screenShareInfo.setHeight(callVideoMinHeight);
|
|
2969
|
+
sendCallMetaData({
|
|
2970
|
+
id: callMetaDataTypes.SCREENSHAREMETADATA,
|
|
2971
|
+
userid: chatMessaging.userInfo.id,
|
|
2972
|
+
content: {
|
|
2973
|
+
dimension: {
|
|
2974
|
+
width: screenShareInfo.getWidth(),
|
|
2975
|
+
height: screenShareInfo.getHeight()
|
|
2976
|
+
}
|
|
2977
|
+
}
|
|
2978
|
+
});
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2817
2981
|
callStateController.addScreenShareToCall(direction, shareScreen);
|
|
2818
2982
|
}
|
|
2819
2983
|
callback && callback(result);
|
|
@@ -2847,7 +3011,7 @@
|
|
|
2847
3011
|
return;
|
|
2848
3012
|
}
|
|
2849
3013
|
|
|
2850
|
-
if(!
|
|
3014
|
+
if(!screenShareInfo.iAmOwner()) {
|
|
2851
3015
|
chatEvents.fireEvent('error', {
|
|
2852
3016
|
code: 999,
|
|
2853
3017
|
message: 'You can not end others screen sharing!'
|
|
@@ -2868,6 +3032,34 @@
|
|
|
2868
3032
|
});
|
|
2869
3033
|
};
|
|
2870
3034
|
|
|
3035
|
+
this.resizeScreenShare = function (params, callback) {
|
|
3036
|
+
var result = {}
|
|
3037
|
+
if(screenShareInfo.isStarted() && screenShareInfo.iAmOwner()) {
|
|
3038
|
+
screenShareInfo.setWidth(params.width);
|
|
3039
|
+
screenShareInfo.setHeight(params.height);
|
|
3040
|
+
|
|
3041
|
+
applyScreenShareSizeToElement()
|
|
3042
|
+
|
|
3043
|
+
sendCallMetaData({
|
|
3044
|
+
id: callMetaDataTypes.SCREENSHAREMETADATA,
|
|
3045
|
+
userid: chatMessaging.userInfo.id,
|
|
3046
|
+
content: {
|
|
3047
|
+
dimension: {
|
|
3048
|
+
width: screenShareInfo.getWidth(),
|
|
3049
|
+
height: screenShareInfo.getHeight()
|
|
3050
|
+
}
|
|
3051
|
+
}
|
|
3052
|
+
})
|
|
3053
|
+
|
|
3054
|
+
result.hasError = false;
|
|
3055
|
+
} else {
|
|
3056
|
+
result.hasError = true;
|
|
3057
|
+
result.errorMessage = 'You can not apply size to others ScreenShare or ScreenShare is not started'
|
|
3058
|
+
}
|
|
3059
|
+
|
|
3060
|
+
callback && callback(result);
|
|
3061
|
+
};
|
|
3062
|
+
|
|
2871
3063
|
this.getCallsList = function (params, callback) {
|
|
2872
3064
|
var getCallListData = {
|
|
2873
3065
|
chatMessageVOType: chatMessageVOTypes.GET_CALLS,
|
package/src/chat.js
CHANGED
|
@@ -13919,6 +13919,8 @@
|
|
|
13919
13919
|
|
|
13920
13920
|
this.startScreenShare = callModule.startScreenShare;
|
|
13921
13921
|
|
|
13922
|
+
this.resizeScreenShare = callModule.resizeScreenShare
|
|
13923
|
+
|
|
13922
13924
|
this.endScreenShare = callModule.endScreenShare;
|
|
13923
13925
|
|
|
13924
13926
|
this.getCallsList = callModule.getCallsList;
|