@flashphoner/sfusdk-examples 2.0.129 → 2.0.131
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/package.json +2 -2
- package/src/client/chat.js +22 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flashphoner/sfusdk-examples",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.131",
|
|
4
4
|
"description": "Official Flashphoner WebCallServer SFU SDK usage examples",
|
|
5
5
|
"main": "dist/sfu.js",
|
|
6
6
|
"types": "src/sfu.ts",
|
|
@@ -27,6 +27,6 @@
|
|
|
27
27
|
"webpack-cli": "^4.9.2"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@flashphoner/sfusdk": "^2.0.
|
|
30
|
+
"@flashphoner/sfusdk": "^2.0.130"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/client/chat.js
CHANGED
|
@@ -6,7 +6,10 @@ const createChat = function(room, messages, input, sendButton) {
|
|
|
6
6
|
const chatEventColour = "navy";
|
|
7
7
|
|
|
8
8
|
room.on(constants.SFU_ROOM_EVENT.MESSAGE, function(e) {
|
|
9
|
-
appendMessage(
|
|
9
|
+
appendMessage({
|
|
10
|
+
nickName: getNickName(e.message),
|
|
11
|
+
message: getMessage(e.message)
|
|
12
|
+
}, chatOtherColour, chatTextColour);
|
|
10
13
|
}).on(constants.SFU_ROOM_EVENT.JOINED, function(e) {
|
|
11
14
|
appendMessage({
|
|
12
15
|
nickName: e.name,
|
|
@@ -64,4 +67,22 @@ const createChat = function(room, messages, input, sendButton) {
|
|
|
64
67
|
let currentdate = new Date();
|
|
65
68
|
return currentdate.getHours() + ":" + currentdate.getMinutes() + ":" + currentdate.getSeconds();
|
|
66
69
|
}
|
|
70
|
+
|
|
71
|
+
const getNickName = function(msgData) {
|
|
72
|
+
let nickName = "unknown";
|
|
73
|
+
if (msgData.nickName) {
|
|
74
|
+
nickName = msgData.nickName;
|
|
75
|
+
} else if (msgData.message.nickName) {
|
|
76
|
+
nickName = msgData.message.nickName;
|
|
77
|
+
}
|
|
78
|
+
return nickName;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const getMessage = function(msgData) {
|
|
82
|
+
let message = "";
|
|
83
|
+
if (msgData.message) {
|
|
84
|
+
message = JSON.parse(msgData.message).payload;
|
|
85
|
+
}
|
|
86
|
+
return message;
|
|
87
|
+
}
|
|
67
88
|
}
|