@flashphoner/sfusdk-examples 2.0.57 → 2.0.65
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-lock.json +4688 -0
- package/package.json +2 -2
- package/src/client/main.js +3 -3
- package/src/player/player.js +1 -2
- package/src/sfu.ts +3 -5
- package/src/two-way-streaming/two-way-streaming.js +2 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flashphoner/sfusdk-examples",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.65",
|
|
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.62"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/client/main.js
CHANGED
|
@@ -2,6 +2,7 @@ const constants = SFU.constants;
|
|
|
2
2
|
const sfu = SFU;
|
|
3
3
|
let localDisplay;
|
|
4
4
|
let cControls;
|
|
5
|
+
let pc;
|
|
5
6
|
|
|
6
7
|
const defaultConfig = {
|
|
7
8
|
room: {
|
|
@@ -62,10 +63,9 @@ function connect() {
|
|
|
62
63
|
//disable controls
|
|
63
64
|
cControls.muteInput();
|
|
64
65
|
//create peer connection
|
|
65
|
-
|
|
66
|
+
pc = new RTCPeerConnection();
|
|
66
67
|
//get config object for room creation
|
|
67
68
|
const roomConfig = cControls.roomConfig();
|
|
68
|
-
roomConfig.pc = pc;
|
|
69
69
|
//kick off connect to server and local room creation
|
|
70
70
|
const session = sfu.createRoom(roomConfig);
|
|
71
71
|
session.on(constants.SFU_EVENT.CONNECTED, function() {
|
|
@@ -125,7 +125,7 @@ function connect() {
|
|
|
125
125
|
room.updateState(config);
|
|
126
126
|
});
|
|
127
127
|
//join room
|
|
128
|
-
room.join(config);
|
|
128
|
+
room.join(pc, null, config);
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
|
package/src/player/player.js
CHANGED
|
@@ -96,7 +96,6 @@ const connect = function(state) {
|
|
|
96
96
|
pc = new RTCPeerConnection();
|
|
97
97
|
//get config object for room creation
|
|
98
98
|
const roomConfig = getRoomConfig(mainConfig);
|
|
99
|
-
roomConfig.pc = pc;
|
|
100
99
|
roomConfig.url = $("#url").val();
|
|
101
100
|
roomConfig.roomName = $("#roomName").val();
|
|
102
101
|
roomConfig.nickname = $("#" + state.inputId()).val();
|
|
@@ -168,7 +167,7 @@ const onStopClick = function(state) {
|
|
|
168
167
|
const playStreams = function(state) {
|
|
169
168
|
//create remote display item to show remote streams
|
|
170
169
|
remoteDisplay = initRemoteDisplay(document.getElementById("remoteVideo"), state.room, state.pc);
|
|
171
|
-
state.room.join();
|
|
170
|
+
state.room.join(state.pc);
|
|
172
171
|
}
|
|
173
172
|
|
|
174
173
|
const stopStreams = function(state) {
|
package/src/sfu.ts
CHANGED
|
@@ -4,8 +4,7 @@ export function createRoom(options: {
|
|
|
4
4
|
url: string,
|
|
5
5
|
roomName: string,
|
|
6
6
|
pin: string,
|
|
7
|
-
nickname: string
|
|
8
|
-
pc: RTCPeerConnection
|
|
7
|
+
nickname: string
|
|
9
8
|
}) {
|
|
10
9
|
const sfu = new Sfu();
|
|
11
10
|
sfu.connect({
|
|
@@ -13,10 +12,9 @@ export function createRoom(options: {
|
|
|
13
12
|
nickname: options.nickname,
|
|
14
13
|
logGroup: options.roomName
|
|
15
14
|
});
|
|
16
|
-
|
|
15
|
+
sfu.createRoom({
|
|
17
16
|
name: options.roomName,
|
|
18
|
-
pin: options.pin
|
|
19
|
-
pc: options.pc
|
|
17
|
+
pin: options.pin
|
|
20
18
|
});
|
|
21
19
|
return sfu;
|
|
22
20
|
}
|
|
@@ -157,7 +157,6 @@ const connect = function(state) {
|
|
|
157
157
|
pc = new RTCPeerConnection();
|
|
158
158
|
//get config object for room creation
|
|
159
159
|
const roomConfig = getRoomConfig(mainConfig);
|
|
160
|
-
roomConfig.pc = pc;
|
|
161
160
|
roomConfig.url = $("#url").val();
|
|
162
161
|
roomConfig.roomName = $("#roomName").val();
|
|
163
162
|
roomConfig.nickname = $("#" + state.inputId()).val();
|
|
@@ -277,7 +276,7 @@ const publishStreams = async function(state) {
|
|
|
277
276
|
subscribeTrackToEndedEvent(state.room, track, state.pc);
|
|
278
277
|
});
|
|
279
278
|
});
|
|
280
|
-
state.room.join(config);
|
|
279
|
+
state.room.join(state.pc, null, config);
|
|
281
280
|
// TODO: Use room state or promises to detect if publishing started to enable stop button
|
|
282
281
|
state.waitFor(document.getElementById("localVideo"), 3000);
|
|
283
282
|
}
|
|
@@ -302,7 +301,7 @@ const playStreams = function(state) {
|
|
|
302
301
|
if (state.isConnected() && state.isActive()) {
|
|
303
302
|
//create remote display item to show remote streams
|
|
304
303
|
remoteDisplay = initRemoteDisplay(document.getElementById("remoteVideo"), state.room, state.pc);
|
|
305
|
-
state.room.join();
|
|
304
|
+
state.room.join(state.pc);
|
|
306
305
|
}
|
|
307
306
|
$("#" + state.buttonId()).prop('disabled', false);
|
|
308
307
|
}
|