@flashphoner/sfusdk-examples 2.0.316 → 2.0.322

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashphoner/sfusdk-examples",
3
- "version": "2.0.316",
3
+ "version": "2.0.322",
4
4
  "description": "Official Flashphoner WebCallServer SFU SDK usage examples",
5
5
  "main": "dist/sfu.js",
6
6
  "types": "src/sfu.ts",
@@ -27,7 +27,7 @@
27
27
  "webpack-cli": "^4.10.0"
28
28
  },
29
29
  "dependencies": {
30
- "@flashphoner/sfusdk": "^2.0.193",
30
+ "@flashphoner/sfusdk": "^2.0.321",
31
31
  "kalmanjs": "^1.1.0"
32
32
  }
33
33
  }
@@ -9,7 +9,8 @@ const createControls = function (config) {
9
9
  roomName: document.getElementById("roomName"),
10
10
  roomPin: document.getElementById("roomPin"),
11
11
  nickName: document.getElementById("nickName"),
12
- enter: document.getElementById("startButton")
12
+ enter: document.getElementById("startButton"),
13
+ transport: document.getElementById("transport")
13
14
  },
14
15
  addVideoTrack: {
15
16
  source: document.getElementById("addVideoTrackSource"),
@@ -171,7 +172,8 @@ const createControls = function (config) {
171
172
  url: controls.entrance.url.value,
172
173
  roomName: controls.entrance.roomName.value,
173
174
  pin: controls.entrance.roomPin.value,
174
- nickname: controls.entrance.nickName.value
175
+ nickname: controls.entrance.nickName.value,
176
+ transport: controls.entrance.transport.value
175
177
  };
176
178
  if (config.room.failedProbesThreshold !== undefined) {
177
179
  roomConfig.failedProbesThreshold = config.room.failedProbesThreshold;
@@ -216,6 +216,14 @@
216
216
  <label for="nickName">Nickname</label>
217
217
  <input class="form-control" id="nickName" type="text" value="Bob">
218
218
  </div>
219
+
220
+ <div class="row mb-2">
221
+ <label for="transport">Transport</label>
222
+ <select class="form-select" id="transport">
223
+ <option value="" selected>Auto (server default)</option>
224
+ <!-- Other options are populated dynamically by init() in main.js -->
225
+ </select>
226
+ </div>
219
227
  </div>
220
228
  <div class="modal-footer">
221
229
  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal" onclick="cancel()">Close</button>
@@ -78,6 +78,15 @@ const init = function () {
78
78
  //use default config
79
79
  cControls = createControls(defaultConfig);
80
80
  });
81
+
82
+ // insert transport values in entrance modal
83
+ const transportSelect = document.getElementById('transport');
84
+ Object.values(constants.SFU_TRANSPORT_TYPE).forEach(value => {
85
+ const option = document.createElement('option');
86
+ option.value = value;
87
+ option.textContent = value;
88
+ transportSelect.appendChild(option);
89
+ });
81
90
  //open entrance modal
82
91
  $('#entranceModal').modal('show');
83
92
  }
@@ -202,7 +211,8 @@ const publishPreconfiguredStreams = async function (room, pc, streams) {
202
211
  localDisplay.add(s.stream.id, "local", s.stream, contentType);
203
212
  });
204
213
  //join room
205
- await room.join(pc, null, config, 10);
214
+ const transportType = cControls.roomConfig().transport;
215
+ await room.join(pc, null, config, 10, transportType);
206
216
  // Enable Delete button for each preconfigured stream #WCS-3689
207
217
  streams.forEach(function (s) {
208
218
  $('#' + s.stream.id + "-button").prop('disabled', false);
package/src/sfu.ts CHANGED
@@ -4,7 +4,8 @@ import {
4
4
  RoomEvent,
5
5
  SfuEvent,
6
6
  State,
7
- StatsType
7
+ StatsType,
8
+ TransportType
8
9
  } from "@flashphoner/sfusdk";
9
10
 
10
11
  export async function createRoom(options: {
@@ -38,7 +39,8 @@ export const constants = {
38
39
  SFU_EVENT: SfuEvent,
39
40
  SFU_ROOM_EVENT: RoomEvent,
40
41
  SFU_STATE: State,
41
- SFU_RTC_STATS_TYPE: StatsType
42
+ SFU_RTC_STATS_TYPE: StatsType,
43
+ SFU_TRANSPORT_TYPE: TransportType
42
44
  }
43
45
 
44
46
  export function createFilter() : KalmanFilter {