@flashphoner/websdk 2.0.255 → 2.0.257

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.
@@ -1,4 +1,4 @@
1
- Web SDK - 2.0.255
1
+ Web SDK - 2.0.257
2
2
 
3
3
  [Download builds](https://docs.flashphoner.com/display/WEBSDK2EN/Web+SDK+release+notes)
4
4
 
@@ -140,13 +140,21 @@ function playBtnClick() {
140
140
  function publishStream() {
141
141
  var session = Flashphoner.getSessions()[0];
142
142
  var streamName = $('#publishStream').val();
143
- session.createStream({
143
+
144
+ var options = {
144
145
  name: streamName,
145
146
  display: localVideo,
146
147
  cacheLocalResources: true,
147
148
  receiveVideo: false,
148
149
  receiveAudio: false
149
- }).on(STREAM_STATUS.PUBLISHING, function (stream) {
150
+ };
151
+
152
+ if ($("#forceRelay").is(':checked')) {
153
+ options.transport = "UDP";
154
+ }
155
+
156
+ session.createStream(options)
157
+ .on(STREAM_STATUS.PUBLISHING, function (stream) {
150
158
  setStatus("#publishStatus", STREAM_STATUS.PUBLISHING);
151
159
  onPublishing(stream);
152
160
  }).on(STREAM_STATUS.UNPUBLISHED, function () {
@@ -161,10 +169,18 @@ function publishStream() {
161
169
  function playStream() {
162
170
  var session = Flashphoner.getSessions()[0];
163
171
  var streamName = $('#playStream').val();
164
- session.createStream({
172
+
173
+ var options = {
165
174
  name: streamName,
166
- display: remoteVideo
167
- }).on(STREAM_STATUS.PLAYING, function (stream) {
175
+ display: remoteVideo,
176
+ };
177
+
178
+ if ($("#forceRelay").is(':checked')) {
179
+ options.transport = "UDP";
180
+ }
181
+
182
+ session.createStream(options)
183
+ .on(STREAM_STATUS.PLAYING, function (stream) {
168
184
  document.getElementById(stream.id()).addEventListener('resize', function (event) {
169
185
  resizeVideo(event.target);
170
186
  });
@@ -39,45 +39,45 @@
39
39
  <div id="row">
40
40
  <h2 id="notifyFlash" class="text-danger"></h2>
41
41
  <div class="col-sm-10 text-center">
42
- <div class="col-sm-6 text-center">
42
+ <div class="col-sm-6 text-center" style="margin-bottom: 20px">
43
+ <div class="text-center text-muted" style="margin-bottom: 10px">My Screen</div>
43
44
  <div class="col-sm-12 text-center">
44
45
  <div class="col-sm-4">
45
- <div class="form-group" id="fpsForm">
46
+ <div class="form-group" id="screenFpsForm">
46
47
  <span class="text-muted">FPS</span>
47
- <input type="text" class="form-control" id="fps" value="15"/>
48
+ <input type="text" class="form-control" id="screenFps" value="5"/>
48
49
  </div>
49
50
  </div>
50
51
  <div class="col-sm-4">
51
- <div class="form-group" id="widthForm">
52
+ <div class="form-group" id="screenWidthForm">
52
53
  <span class="text-muted">Width</span>
53
- <input type="text" class="form-control" id="width" value="640"/>
54
+ <input type="text" class="form-control" id="screenWidth" value="1280"/>
54
55
  </div>
55
56
  </div>
56
57
  <div class="col-sm-4">
57
- <div class="form-group" id="heightForm">
58
+ <div class="form-group" id="screenHeightForm">
58
59
  <span class="text-muted">Height</span>
59
- <input type="text" class="form-control" id="height" value="480"/>
60
+ <input type="text" class="form-control" id="screenHeight" value="720"/>
60
61
  </div>
61
62
  </div>
62
63
  </div>
63
64
  <div class="col-sm-12 text-center">
64
- <div class="col-sm-5">
65
+ <div class="col-sm-6 text-center">
65
66
  <div class="form-group" id="mixer">
66
67
  <span class="text-muted">Add to Mixer?</span>
67
68
  <input type="checkbox" class="checkbox" style="margin: 10px auto" id="useMixer"/>
68
69
  </div>
69
70
  </div>
70
- <div class="col-sm-5">
71
+ <div class="col-sm-6 text-center">
71
72
  <div class="form-group" id="mixerInput">
72
73
  <span class="text-muted">Mixer</span>
73
74
  <input type="text" class="form-control" id="mixerName" placeholder="Mixer name"/>
74
75
  </div>
75
76
  </div>
76
77
  </div>
77
- <div class="fp-localVideo" style="margin-top: 140px">
78
+ <div class="fp-localVideo" style="margin-top: 150px">
78
79
  <div id="localVideoScreen" class="display"></div>
79
80
  </div>
80
- <div class="text-center text-muted">My Screen</div>
81
81
  <div class="row row-space">
82
82
  <div id="screenName"></div>
83
83
  <div id="screenStatus"></div>
@@ -87,10 +87,46 @@
87
87
  </div>
88
88
  </div>
89
89
  <div class="col-sm-6 text-center">
90
- <div class="fp-localVideo" style="margin-top: 140px">
90
+ <div class="text-center text-muted" style="margin-bottom: 10px">My Camera</div>
91
+ <div class="col-sm-12 text-center">
92
+ <div class="col-sm-4">
93
+ <div class="form-group" id="cameraFpsForm">
94
+ <span class="text-muted">FPS</span>
95
+ <input type="text" class="form-control" id="cameraFps" value="24"/>
96
+ </div>
97
+ </div>
98
+ <div class="col-sm-4">
99
+ <div class="form-group" id="cameraWidthForm">
100
+ <span class="text-muted">Width</span>
101
+ <input type="text" class="form-control" id="cameraWidth" value="640"/>
102
+ </div>
103
+ </div>
104
+ <div class="col-sm-4">
105
+ <div class="form-group" id="cameraHeightForm">
106
+ <span class="text-muted">Height</span>
107
+ <input type="text" class="form-control" id="cameraHeight" value="480"/>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ <div class="col-sm-12 text-center">
112
+ <div class="col-sm-6 text-center">
113
+ <div class="form-group" id="audioInputForm">
114
+ <span class="text-muted">Mic</span>
115
+ <select class="form-control" id="audioInput">
116
+ </select>
117
+ </div>
118
+ </div>
119
+ <div class="col-sm-6 text-center">
120
+ <div class="form-group" id="videoInputForm">
121
+ <span class="text-muted">Camera</span>
122
+ <select class="form-control" id="videoInput">
123
+ </select>
124
+ </div>
125
+ </div>
126
+ </div>
127
+ <div class="fp-localVideo" style="margin-top: 150px">
91
128
  <div id="localVideoCamera" class="display"></div>
92
129
  </div>
93
- <div class="text-center text-muted">My Camera</div>
94
130
  <div class="row row-space">
95
131
  <div id="cameraName"></div>
96
132
  <div id="cameraStatus"></div>
@@ -99,8 +135,7 @@
99
135
  <div id="cameraAvailableBitrate"></div>
100
136
  </div>
101
137
  </div>
102
- <div class="row row-space text-center" style="margin-top: 20px">
103
- <!--<div class="col-sm-10 text-center">-->
138
+ <div class="row row-space text-center" style="margin-top: 30px">
104
139
  <div class="col-sm-7">
105
140
  <div class="form-group" id="urlForm">
106
141
  <input type="text" class="form-control" id="url" placeholder="Enter url with stream name"/>
@@ -112,7 +147,6 @@
112
147
  <div class="col-sm-2 text-left">
113
148
  <button id="publishBtn" type="button" class="btn btn-default">Start</button>
114
149
  </div>
115
- <!--</div>-->
116
150
  </div>
117
151
  </div>
118
152
 
@@ -25,10 +25,42 @@ const init_page = function() {
25
25
  localVideoCamera = document.getElementById("localVideoCamera");
26
26
  $("#url").val(setURL() + "/" + createUUID(8));
27
27
  $("#mixerName").val("mixer");
28
+
29
+ Flashphoner.getMediaDevices(null, true).then(function (list) {
30
+ addDeviceToSelect(list.audio, "audioInput");
31
+ addDeviceToSelect(list.video, "videoInput");
32
+ });
28
33
  onDisconnected();
29
34
 
30
35
  }
31
36
 
37
+ const addDeviceToSelect = function (devices, selectId) {
38
+ devices.forEach(function (device) {
39
+ var select = document.getElementById(selectId);
40
+ var deviceInList = false;
41
+ for (var i = 0; i < select.options.length; i++) {
42
+ if (select.options[i].value === device.id) {
43
+ deviceInList = true;
44
+ break;
45
+ }
46
+ }
47
+ if (!deviceInList) {
48
+ var option = document.createElement("option");
49
+ option.text = device.label || device.id;
50
+ option.value = device.id;
51
+ if (selectId === "videoInput") {
52
+ if (option.text.toLowerCase().indexOf("back") >= 0 && select.children.length > 0) {
53
+ select.insertBefore(option, select.children[0]);
54
+ } else {
55
+ select.appendChild(option);
56
+ }
57
+ } else if (selectId === "audioInput") {
58
+ select.appendChild(option);
59
+ }
60
+ }
61
+ });
62
+ }
63
+
32
64
  const isSafariMacOS = function() {
33
65
  return Browser.isSafari() && !Browser.isAndroid() && !Browser.isiOS();
34
66
  }
@@ -131,9 +163,9 @@ const startStreamingScreen = function(session) {
131
163
  let streamName = getStreamName("screen", field("url"));
132
164
  let constraints = {
133
165
  video: {
134
- width: parseInt($('#width').val()),
135
- height: parseInt($('#height').val()),
136
- frameRate: parseInt($('#fps').val()),
166
+ width: parseInt($('#screenWidth').val()),
167
+ height: parseInt($('#screenHeight').val()),
168
+ frameRate: parseInt($('#screenFps').val()),
137
169
  type: "screen",
138
170
  withoutExtension: true
139
171
  }
@@ -178,7 +210,18 @@ const startStreamingCamera = function(session, screenStream) {
178
210
  let streamName = getStreamName("camera", field("url"));
179
211
  let options = {
180
212
  name: streamName,
181
- display: localVideoCamera
213
+ display: localVideoCamera,
214
+ constraints: {
215
+ video: {
216
+ deviceId: $('#videoInput').val(),
217
+ width: parseInt($('#cameraWidth').val()),
218
+ height: parseInt($('#cameraHeight').val()),
219
+ frameRate: parseInt($('#cameraFps').val()),
220
+ },
221
+ audio: {
222
+ deviceId: $('#audioInput').val()
223
+ }
224
+ }
182
225
  }
183
226
  session.createStream(options).on(STREAM_STATUS.PUBLISHING, function(cameraStream) {
184
227
  document.getElementById(cameraStream.id()).addEventListener('resize', function(event){
@@ -13703,10 +13703,14 @@ function normalizeConstraints(constraints) {
13703
13703
 
13704
13704
  //WCS-1972. fixed "TypeError"
13705
13705
  // Set default FPS value
13706
- var frameRate = !constraints.video.frameRate || constraints.video.frameRate == 0 ? 30 : constraints.video.frameRate;
13707
- constraints.video.frameRate = {
13708
- ideal: frameRate
13709
- };
13706
+ if (browserDetails.browser === "chrome" && browserDetails.version >= 134) {
13707
+ // Do not normalize framerate in Chrome 134 #WCS-4360
13708
+ } else {
13709
+ var frameRate = !constraints.video.frameRate || constraints.video.frameRate == 0 ? 30 : constraints.video.frameRate;
13710
+ constraints.video.frameRate = {
13711
+ ideal: frameRate
13712
+ };
13713
+ }
13710
13714
  }
13711
13715
  }
13712
13716
  if (constraints.audio) {