@flashphoner/websdk 2.0.256 → 2.0.258
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/docTemplate/README.md +1 -1
- package/examples/demo/streaming/media_devices_manager/manager.js +50 -3
- package/examples/demo/streaming/media_devices_manager/media_device_manager.html +14 -0
- package/examples/demo/streaming/screen-camera-mixer/screen-camera-mixer.html +50 -16
- package/examples/demo/streaming/screen-camera-mixer/screen-camera-mixer.js +47 -4
- package/flashphoner-no-flash.js +121 -14
- package/flashphoner-no-flash.min.js +2 -2
- package/flashphoner-no-webrtc.js +39 -1
- package/flashphoner-no-webrtc.min.js +1 -1
- package/flashphoner-no-wsplayer.js +121 -14
- package/flashphoner-no-wsplayer.min.js +2 -2
- package/flashphoner-room-api-webrtc-only.js +120 -13
- package/flashphoner-room-api-webrtc-only.min.js +1 -1
- package/flashphoner-room-api.js +117 -15
- package/flashphoner-room-api.min.js +2 -2
- package/flashphoner-temasys-flash-websocket-without-adapterjs.js +39 -1
- package/flashphoner-temasys-flash-websocket.js +39 -1
- package/flashphoner-temasys-flash-websocket.min.js +1 -1
- package/flashphoner-webrtc-only.js +120 -13
- package/flashphoner-webrtc-only.min.js +1 -1
- package/flashphoner.js +121 -14
- package/flashphoner.min.js +2 -2
- package/package.json +1 -1
- package/src/constants.d.ts +6 -0
- package/src/constants.js +6 -0
- package/src/flashphoner-core.d.ts +2 -0
- package/src/flashphoner-core.js +32 -0
- package/src/media-source-media-provider.js +1 -1
- package/src/webrtc-media-provider.js +78 -14
package/docTemplate/README.md
CHANGED
|
@@ -202,6 +202,9 @@ function onUnpublished() {
|
|
|
202
202
|
publishStatsIntervalID = null;
|
|
203
203
|
}
|
|
204
204
|
enablePublishToggles(false);
|
|
205
|
+
$("#resolutionBtn").prop('disabled', true);
|
|
206
|
+
$("#fpsBtn").prop('disabled', true);
|
|
207
|
+
$("#bitrateBtn").prop('disabled', true);
|
|
205
208
|
}
|
|
206
209
|
|
|
207
210
|
function publishBtnClick() {
|
|
@@ -239,6 +242,46 @@ function onPublishing(stream) {
|
|
|
239
242
|
});
|
|
240
243
|
}).prop('disabled', !($('#sendAudio').is(':checked')));
|
|
241
244
|
stream.setVolume(currentVolumeValue);
|
|
245
|
+
$("#resolutionBtn").off('click').click(function () {
|
|
246
|
+
onResolutionClick(stream);
|
|
247
|
+
}).prop('disabled', false);
|
|
248
|
+
$("#fpsBtn").off('click').click(function () {
|
|
249
|
+
onFpsClick(stream);
|
|
250
|
+
}).prop('disabled', false);
|
|
251
|
+
$("#bitrateBtn").off('click').click(function () {
|
|
252
|
+
onBitrateClick(stream);
|
|
253
|
+
}).prop('disabled', false);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function onResolutionClick(stream) {
|
|
257
|
+
stream.updateVideoResolution({
|
|
258
|
+
width: parseInt($('#sendWidth').val()),
|
|
259
|
+
height: parseInt($('#sendHeight').val())
|
|
260
|
+
}).then(function(constraints) {
|
|
261
|
+
console.log("Publishing video constraints changed to " + JSON.stringify(constraints));
|
|
262
|
+
}).catch(function(e) {
|
|
263
|
+
console.error("Error " + e);
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function onBitrateClick(stream) {
|
|
268
|
+
stream.updateVideoSettings({
|
|
269
|
+
maxBitrate: parseInt($('#sendVideoMaxBitrate').val())
|
|
270
|
+
}).then(function(encodings) {
|
|
271
|
+
console.log("Publishing video encoder parameters changed to " + JSON.stringify(encodings));
|
|
272
|
+
}).catch(function(e) {
|
|
273
|
+
console.error("Error " + e);
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function onFpsClick(stream) {
|
|
278
|
+
stream.updateVideoSettings({
|
|
279
|
+
frameRate: parseInt($('#fps').val())
|
|
280
|
+
}).then(function(encodings) {
|
|
281
|
+
console.log("Publishing video encoder parameters changed to " + JSON.stringify(encodings));
|
|
282
|
+
}).catch(function(e) {
|
|
283
|
+
console.error("Error " + e);
|
|
284
|
+
});
|
|
242
285
|
}
|
|
243
286
|
|
|
244
287
|
function onPlaying(stream) {
|
|
@@ -552,7 +595,12 @@ function setStatus(selector, status, stream) {
|
|
|
552
595
|
|
|
553
596
|
function muteInputs(selector) {
|
|
554
597
|
$('[class*=group][id^=' + selector + ']').find('input').each(function () {
|
|
555
|
-
if ($(this).attr('id') !== 'audioOutput'
|
|
598
|
+
if ($(this).attr('id') !== 'audioOutput' &&
|
|
599
|
+
$(this).attr('id') !== 'sendWidth' &&
|
|
600
|
+
$(this).attr('id') !== 'sendHeight' &&
|
|
601
|
+
$(this).attr('id') !== 'fps' &&
|
|
602
|
+
$(this).attr('id') !== 'sendVideoMinBitrate' &&
|
|
603
|
+
$(this).attr('id') !== 'sendVideoMaxBitrate') {
|
|
556
604
|
$(this).prop('disabled', true);
|
|
557
605
|
}
|
|
558
606
|
});
|
|
@@ -579,8 +627,7 @@ function unmuteInputs(selector) {
|
|
|
579
627
|
|
|
580
628
|
|
|
581
629
|
function resizeLocalVideo(event) {
|
|
582
|
-
|
|
583
|
-
if (requested.width != event.target.videoWidth || requested.height != event.target.videoHeight) {
|
|
630
|
+
if (parseInt($('#sendWidth').val()) != event.target.videoWidth || parseInt($('#sendHeight').val()) != event.target.videoHeight) {
|
|
584
631
|
console.warn("Camera does not support requested resolution, actual resolution is " + event.target.videoWidth + "x" + event.target.videoHeight);
|
|
585
632
|
}
|
|
586
633
|
$("#publishResolution").text(event.target.videoWidth + "x" + event.target.videoHeight);
|
|
@@ -202,17 +202,27 @@
|
|
|
202
202
|
<div class="form-group" id="sendSizeForm">
|
|
203
203
|
<label style="text-align: left" class="col-sm-4 control-label">Size</label>
|
|
204
204
|
<div class="col-sm-4">
|
|
205
|
+
<span>width</span>
|
|
205
206
|
<input type="text" class="form-control" id="sendWidth" value="640">
|
|
206
207
|
</div>
|
|
207
208
|
<div class="col-sm-4">
|
|
209
|
+
<span>height</span>
|
|
208
210
|
<input type="text" class="form-control" id="sendHeight" value="480">
|
|
209
211
|
</div>
|
|
212
|
+
<label style="text-align: left" class="col-sm-4 control-label"></label>
|
|
213
|
+
<div class="col-sm-8">
|
|
214
|
+
<button type="button" class="btn btn-default form-control" id="resolutionBtn">Apply</button>
|
|
215
|
+
</div>
|
|
216
|
+
|
|
210
217
|
</div>
|
|
211
218
|
<div class="form-group" id="fpsForm">
|
|
212
219
|
<label style="text-align: left" class="col-sm-4 control-label">FPS</label>
|
|
213
220
|
<div class="col-sm-4">
|
|
214
221
|
<input type="text" class="form-control" id="fps" value="30">
|
|
215
222
|
</div>
|
|
223
|
+
<div class="col-sm-4">
|
|
224
|
+
<button type="button" class="btn btn-default form-control" id="fpsBtn">Apply</button>
|
|
225
|
+
</div>
|
|
216
226
|
</div>
|
|
217
227
|
<div class="form-group" id="sendBitrateForm">
|
|
218
228
|
<label style="text-align: left" class="col-sm-4 control-label">Bitrate</label>
|
|
@@ -224,6 +234,10 @@
|
|
|
224
234
|
<span>max</span>
|
|
225
235
|
<input type="text" class="form-control" id="sendVideoMaxBitrate" value="0">
|
|
226
236
|
</div>
|
|
237
|
+
<label style="text-align: left" class="col-sm-4 control-label"></label>
|
|
238
|
+
<div class="col-sm-8">
|
|
239
|
+
<button type="button" class="btn btn-default form-control" id="bitrateBtn">Apply</button>
|
|
240
|
+
</div>
|
|
227
241
|
</div>
|
|
228
242
|
<div class="form-group" id="cpuOveruseDetectionForm">
|
|
229
243
|
<label style="text-align: left" class="col-sm-4 control-label" for="cpuOveruseDetectionForm">COD
|
|
@@ -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="
|
|
46
|
+
<div class="form-group" id="screenFpsForm">
|
|
46
47
|
<span class="text-muted">FPS</span>
|
|
47
|
-
<input type="text" class="form-control" id="
|
|
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="
|
|
52
|
+
<div class="form-group" id="screenWidthForm">
|
|
52
53
|
<span class="text-muted">Width</span>
|
|
53
|
-
<input type="text" class="form-control" id="
|
|
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="
|
|
58
|
+
<div class="form-group" id="screenHeightForm">
|
|
58
59
|
<span class="text-muted">Height</span>
|
|
59
|
-
<input type="text" class="form-control" id="
|
|
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-
|
|
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-
|
|
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:
|
|
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="
|
|
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:
|
|
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($('#
|
|
135
|
-
height: parseInt($('#
|
|
136
|
-
frameRate: parseInt($('#
|
|
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){
|