@flashphoner/websdk 2.0.259 → 2.0.260
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/stream-zoom/stream-zoom.css +23 -0
- package/examples/demo/streaming/stream-zoom/stream-zoom.html +59 -0
- package/examples/demo/streaming/stream-zoom/stream-zoom.js +166 -0
- package/flashphoner-no-flash.js +156 -0
- package/flashphoner-no-flash.min.js +2 -2
- package/flashphoner-no-webrtc.js +62 -0
- package/flashphoner-no-webrtc.min.js +1 -1
- package/flashphoner-no-wsplayer.js +156 -0
- package/flashphoner-no-wsplayer.min.js +2 -2
- package/flashphoner-room-api-webrtc-only.js +156 -0
- package/flashphoner-room-api-webrtc-only.min.js +1 -1
- package/flashphoner-room-api.js +100 -0
- package/flashphoner-room-api.min.js +2 -2
- package/flashphoner-temasys-flash-websocket-without-adapterjs.js +62 -0
- package/flashphoner-temasys-flash-websocket.js +62 -0
- package/flashphoner-temasys-flash-websocket.min.js +1 -1
- package/flashphoner-webrtc-only.js +156 -0
- package/flashphoner-webrtc-only.min.js +1 -1
- package/flashphoner.js +156 -0
- package/flashphoner.min.js +2 -2
- package/package.json +1 -1
- package/src/flashphoner-core.js +45 -0
- package/src/webrtc-media-provider.js +55 -0
package/docTemplate/README.md
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.fp-remoteVideo {
|
|
2
|
+
border: 1px double #777;
|
|
3
|
+
width: 322px;
|
|
4
|
+
height: 242px;
|
|
5
|
+
margin: 0 auto;
|
|
6
|
+
}
|
|
7
|
+
.fp-remoteVideo>video {
|
|
8
|
+
width: 320px;
|
|
9
|
+
height: 240px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.fp-localVideo {
|
|
13
|
+
border: 1px double #777;
|
|
14
|
+
width: 322px;
|
|
15
|
+
height: 242px;
|
|
16
|
+
margin: 0 auto;
|
|
17
|
+
}
|
|
18
|
+
.fp-localVideo>video {
|
|
19
|
+
width: 320px;
|
|
20
|
+
height: 240px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<link rel="stylesheet" href="../../dependencies/bootstrap/css/bootstrap.css">
|
|
7
|
+
<link rel="stylesheet" href="../../dependencies/bootstrap/font-awesome/css/font-awesome.min.css">
|
|
8
|
+
<link rel="stylesheet" href="stream-zoom.css">
|
|
9
|
+
<title>Streaming with zooming</title>
|
|
10
|
+
<script type="text/javascript" src="../../../../flashphoner.js"></script>
|
|
11
|
+
<script type="text/javascript" src="../../dependencies/js/utils.js"></script>
|
|
12
|
+
|
|
13
|
+
<script type="text/javascript" src="stream-zoom.js"></script>
|
|
14
|
+
</head>
|
|
15
|
+
<body onload="init_page()">
|
|
16
|
+
<div class="container">
|
|
17
|
+
<div class="row">
|
|
18
|
+
|
|
19
|
+
<h2 class="text-center col-sm-9">Streaming with zooming</h2>
|
|
20
|
+
|
|
21
|
+
<h2 id="notifyFlash" class="text-danger"></h2>
|
|
22
|
+
<div class="col-sm-10 text-center">
|
|
23
|
+
<div class="col-sm-5">
|
|
24
|
+
<div id="localVideo" class="fp-localVideo"></div>
|
|
25
|
+
<div class="text-center text-muted">Local</div>
|
|
26
|
+
|
|
27
|
+
</div>
|
|
28
|
+
<div class="col-sm-1 text-center" style="margin: 8% auto">
|
|
29
|
+
<i class="fa fa-arrow-right" aria-hidden="true" style="font-size: 42px"></i>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="col-sm-5">
|
|
32
|
+
<div id="remoteVideo" class="fp-remoteVideo"></div>
|
|
33
|
+
<div class="text-center text-muted">Preview</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="col-sm-8 text-center col-sm-offset-2" style="margin-top: 20px">
|
|
37
|
+
<div class="col-sm-2 text-right">
|
|
38
|
+
<label for="zoom">Zoom</label>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="col-sm-4 text-center">
|
|
41
|
+
<input type="range" id="zoom" class="form-control" />
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="col-sm-8 text-center col-sm-offset-2" style="margin-top: 20px">
|
|
45
|
+
<div class="col-sm-6">
|
|
46
|
+
<input type="text" class="form-control" id="url" placeholder="Enter url with stream name"/>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="col-sm-3 text-left">
|
|
49
|
+
<button id="publishBtn" type="button" class="btn btn-default">Start</button>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
<div class="col-sm-9 text-center" style="margin-top: 20px">
|
|
53
|
+
<div id="status"></div>
|
|
54
|
+
<div id="info"></div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</body>
|
|
59
|
+
</html>
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
const SESSION_STATUS = Flashphoner.constants.SESSION_STATUS;
|
|
2
|
+
const STREAM_STATUS = Flashphoner.constants.STREAM_STATUS;
|
|
3
|
+
let currentSession;
|
|
4
|
+
let localVideo;
|
|
5
|
+
let remoteVideo;
|
|
6
|
+
|
|
7
|
+
const init_page = function() {
|
|
8
|
+
//init api
|
|
9
|
+
try {
|
|
10
|
+
Flashphoner.init();
|
|
11
|
+
} catch(e) {
|
|
12
|
+
setText("notifyFlash", "Your browser doesn't support WebRTC technology needed for this example");
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//local and remote displays
|
|
17
|
+
localVideo = document.getElementById("localVideo");
|
|
18
|
+
remoteVideo = document.getElementById("remoteVideo");
|
|
19
|
+
|
|
20
|
+
setValue("url", setURL() + "/" + createUUID(8));
|
|
21
|
+
//set initial button callback
|
|
22
|
+
onStopped();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const onStarted = function(publishStream, previewStream) {
|
|
26
|
+
setHandler("publishBtn", "click", () => {stopBtnClick(previewStream);}, publishBtnClick);
|
|
27
|
+
setText("publishBtn", "Stop");
|
|
28
|
+
enableItem("publishBtn");
|
|
29
|
+
setUpZoom(publishStream);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const onStopped = function() {
|
|
33
|
+
if (!currentSession) {
|
|
34
|
+
enableItem("url");
|
|
35
|
+
}
|
|
36
|
+
disableItem("zoom");
|
|
37
|
+
enableItem("publishBtn");
|
|
38
|
+
setHandler("publishBtn", "click", publishBtnClick, stopBtnClick);
|
|
39
|
+
setText("publishBtn", "Start");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const publishBtnClick = function() {
|
|
43
|
+
disableItem("publishBtn");
|
|
44
|
+
start();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const stopBtnClick = function(previewStream) {
|
|
48
|
+
disableItem("publishBtn");
|
|
49
|
+
disableItem("zoom");
|
|
50
|
+
if (previewStream) {
|
|
51
|
+
previewStream.stop();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const start = function() {
|
|
56
|
+
//check if we already have session
|
|
57
|
+
if (currentSession) {
|
|
58
|
+
startStreaming(currentSession);
|
|
59
|
+
} else {
|
|
60
|
+
//create session
|
|
61
|
+
let url = getValue("url");
|
|
62
|
+
console.log("Create new session with url " + url);
|
|
63
|
+
Flashphoner.createSession({urlServer: url}).on(SESSION_STATUS.ESTABLISHED, function(session){
|
|
64
|
+
//session connected, start streaming
|
|
65
|
+
currentSession = session;
|
|
66
|
+
startStreaming(session);
|
|
67
|
+
}).on(SESSION_STATUS.DISCONNECTED, function(){
|
|
68
|
+
setStatus(SESSION_STATUS.DISCONNECTED);
|
|
69
|
+
currentSession = null;
|
|
70
|
+
onStopped();
|
|
71
|
+
}).on(SESSION_STATUS.FAILED, function(){
|
|
72
|
+
setStatus(SESSION_STATUS.FAILED);
|
|
73
|
+
currentSession = null;
|
|
74
|
+
onStopped();
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const startStreaming = function(session) {
|
|
80
|
+
let streamName = getValue("url").split('/')[3];
|
|
81
|
+
disableItem("url");
|
|
82
|
+
|
|
83
|
+
session.createStream({
|
|
84
|
+
name: streamName,
|
|
85
|
+
display: localVideo,
|
|
86
|
+
constraints: {
|
|
87
|
+
video: {
|
|
88
|
+
zoom: true
|
|
89
|
+
},
|
|
90
|
+
audio: true
|
|
91
|
+
}
|
|
92
|
+
}).on(STREAM_STATUS.PUBLISHING, function(publishStream){
|
|
93
|
+
setStatus(STREAM_STATUS.PUBLISHING);
|
|
94
|
+
//play preview
|
|
95
|
+
session.createStream({
|
|
96
|
+
name: streamName,
|
|
97
|
+
display: remoteVideo
|
|
98
|
+
}).on(STREAM_STATUS.PLAYING, function(previewStream){
|
|
99
|
+
//enable stop button
|
|
100
|
+
onStarted(publishStream, previewStream);
|
|
101
|
+
}).on(STREAM_STATUS.STOPPED, function(){
|
|
102
|
+
publishStream.stop();
|
|
103
|
+
}).on(STREAM_STATUS.FAILED, function(stream){
|
|
104
|
+
//preview failed, stop publishStream
|
|
105
|
+
if (publishStream.status() === STREAM_STATUS.PUBLISHING) {
|
|
106
|
+
setStatus(STREAM_STATUS.FAILED, stream);
|
|
107
|
+
publishStream.stop();
|
|
108
|
+
}
|
|
109
|
+
}).play();
|
|
110
|
+
}).on(STREAM_STATUS.UNPUBLISHED, function(){
|
|
111
|
+
setStatus(STREAM_STATUS.UNPUBLISHED);
|
|
112
|
+
//enable start button
|
|
113
|
+
onStopped();
|
|
114
|
+
}).on(STREAM_STATUS.FAILED, function(stream){
|
|
115
|
+
setStatus(STREAM_STATUS.FAILED, stream);
|
|
116
|
+
//enable start button
|
|
117
|
+
onStopped();
|
|
118
|
+
}).publish();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const setUpZoom = function(publishStream) {
|
|
122
|
+
// Check if zoom capabilities available
|
|
123
|
+
if (publishStream) {
|
|
124
|
+
let zoom = document.getElementById("zoom");
|
|
125
|
+
let zoomCapabilities = publishStream.getZoomCapabilities();
|
|
126
|
+
|
|
127
|
+
if (zoomCapabilities) {
|
|
128
|
+
// Set up zoom control
|
|
129
|
+
setText("info", "Zoom can be used with the camera");
|
|
130
|
+
setAttribute("info", "class", "text-muted");
|
|
131
|
+
zoom.min = zoomCapabilities.min;
|
|
132
|
+
zoom.max = zoomCapabilities.max;
|
|
133
|
+
zoom.step = zoomCapabilities.step;
|
|
134
|
+
zoom.value = zoomCapabilities.value;
|
|
135
|
+
zoom.oninput = async function(event) {
|
|
136
|
+
await publishStream.setZoom(event.target.value);
|
|
137
|
+
console.log("Zoom value: " + publishStream.getZoom());
|
|
138
|
+
};
|
|
139
|
+
enableItem("zoom");
|
|
140
|
+
} else {
|
|
141
|
+
setText("info", "Zoom can't be used with the camera");
|
|
142
|
+
setAttribute("info", "class", "text-danger");
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Display connection or local stream status
|
|
148
|
+
const setStatus = function(status, stream) {
|
|
149
|
+
setText("status", status);
|
|
150
|
+
setAttribute("status", "class", "")
|
|
151
|
+
if (status === "PUBLISHING") {
|
|
152
|
+
setAttribute("status","class", "text-success");
|
|
153
|
+
setAttribute("info","class", "text-muted");
|
|
154
|
+
setText("info", "");
|
|
155
|
+
} else if (status === "DISCONNECTED" || status === "UNPUBLISHED") {
|
|
156
|
+
setAttribute("info","class", "text-muted");
|
|
157
|
+
setAttribute("status","class", "text-muted");
|
|
158
|
+
setText("info", "");
|
|
159
|
+
} else if (status === "FAILED") {
|
|
160
|
+
setAttribute("status","class", "text-danger");
|
|
161
|
+
if (stream) {
|
|
162
|
+
setText("info", stream.getInfo());
|
|
163
|
+
setAttribute("info","class", "text-muted");
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
package/flashphoner-no-flash.js
CHANGED
|
@@ -11354,6 +11354,65 @@ var createSession = function createSession(options) {
|
|
|
11354
11354
|
throw new Error("This function available for publishing stream only");
|
|
11355
11355
|
}
|
|
11356
11356
|
};
|
|
11357
|
+
|
|
11358
|
+
/**
|
|
11359
|
+
* Get camera zoom capabilities
|
|
11360
|
+
*
|
|
11361
|
+
* @return {Object} zoom capabilities object: max, min, step or null if zoom is not supported
|
|
11362
|
+
* @memberof Stream
|
|
11363
|
+
*/
|
|
11364
|
+
var getZoomCapabilities = function getZoomCapabilities() {
|
|
11365
|
+
if (published() && mediaConnection) {
|
|
11366
|
+
return mediaConnection.getZoomCapabilities();
|
|
11367
|
+
} else {
|
|
11368
|
+
throw new Error("This function available for publishing stream only");
|
|
11369
|
+
}
|
|
11370
|
+
};
|
|
11371
|
+
|
|
11372
|
+
/**
|
|
11373
|
+
* Get current camera zoom value if supported
|
|
11374
|
+
*
|
|
11375
|
+
* @return {number} current camera zoom value
|
|
11376
|
+
* @memberof Stream
|
|
11377
|
+
*/
|
|
11378
|
+
var getZoom = function getZoom() {
|
|
11379
|
+
if (published() && mediaConnection) {
|
|
11380
|
+
return mediaConnection.getZoom();
|
|
11381
|
+
} else {
|
|
11382
|
+
throw new Error("This function available for publishing stream only");
|
|
11383
|
+
}
|
|
11384
|
+
};
|
|
11385
|
+
|
|
11386
|
+
/**
|
|
11387
|
+
* Set camera zoom value if supported
|
|
11388
|
+
*
|
|
11389
|
+
* @param {number} desired camera zoom value
|
|
11390
|
+
* @memberof Stream
|
|
11391
|
+
*/
|
|
11392
|
+
var setZoom = /*#__PURE__*/function () {
|
|
11393
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(value) {
|
|
11394
|
+
return _regenerator().w(function (_context2) {
|
|
11395
|
+
while (1) switch (_context2.n) {
|
|
11396
|
+
case 0:
|
|
11397
|
+
if (!(published() && mediaConnection)) {
|
|
11398
|
+
_context2.n = 2;
|
|
11399
|
+
break;
|
|
11400
|
+
}
|
|
11401
|
+
_context2.n = 1;
|
|
11402
|
+
return mediaConnection.setZoom(value);
|
|
11403
|
+
case 1:
|
|
11404
|
+
return _context2.a(2, _context2.v);
|
|
11405
|
+
case 2:
|
|
11406
|
+
throw new Error("This function available for publishing stream only");
|
|
11407
|
+
case 3:
|
|
11408
|
+
return _context2.a(2);
|
|
11409
|
+
}
|
|
11410
|
+
}, _callee2);
|
|
11411
|
+
}));
|
|
11412
|
+
return function setZoom(_x2) {
|
|
11413
|
+
return _ref2.apply(this, arguments);
|
|
11414
|
+
};
|
|
11415
|
+
}();
|
|
11357
11416
|
stream.play = play;
|
|
11358
11417
|
stream.publish = publish;
|
|
11359
11418
|
stream.stop = _stop;
|
|
@@ -11395,6 +11454,9 @@ var createSession = function createSession(options) {
|
|
|
11395
11454
|
stream.getLogger = getLogger;
|
|
11396
11455
|
stream.updateVideoSettings = updateVideoSettings;
|
|
11397
11456
|
stream.updateVideoResolution = updateVideoResolution;
|
|
11457
|
+
stream.getZoomCapabilities = getZoomCapabilities;
|
|
11458
|
+
stream.getZoom = getZoom;
|
|
11459
|
+
stream.setZoom = setZoom;
|
|
11398
11460
|
streams[id_] = stream;
|
|
11399
11461
|
return stream;
|
|
11400
11462
|
};
|
|
@@ -12226,8 +12288,16 @@ module.exports = {
|
|
|
12226
12288
|
},{}],44:[function(require,module,exports){
|
|
12227
12289
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
12228
12290
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
12291
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
12292
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
12293
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
12294
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
12295
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
12296
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12229
12297
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
12230
12298
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
12299
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12300
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
12231
12301
|
-'use strict';
|
|
12232
12302
|
var browserDetails = require('webrtc-adapter')["default"].browserDetails;
|
|
12233
12303
|
var _require = require('uuid'),
|
|
@@ -12297,6 +12367,8 @@ var createConnection = function createConnection(options) {
|
|
|
12297
12367
|
var useControls = options.useControls || false;
|
|
12298
12368
|
// Stream event handler to rise an event #WCS-4097
|
|
12299
12369
|
var unmuteRequiredEvent = options.unmuteRequiredEvent ? options.unmuteRequiredEvent : null;
|
|
12370
|
+
// Current video capturer zoom #WCS-4579
|
|
12371
|
+
var zoom = null;
|
|
12300
12372
|
if (bidirectional) {
|
|
12301
12373
|
localVideo = getCacheInstance(localDisplay);
|
|
12302
12374
|
if (localVideo) {
|
|
@@ -13107,6 +13179,87 @@ var createConnection = function createConnection(options) {
|
|
|
13107
13179
|
unmuteRequiredEvent();
|
|
13108
13180
|
}
|
|
13109
13181
|
};
|
|
13182
|
+
var getZoomCapabilities = function getZoomCapabilities() {
|
|
13183
|
+
if (localVideo && localVideo.srcObject) {
|
|
13184
|
+
if (constraints.video && constraints.video.zoom) {
|
|
13185
|
+
var _localVideo$srcObject = localVideo.srcObject.getVideoTracks(),
|
|
13186
|
+
_localVideo$srcObject2 = _slicedToArray(_localVideo$srcObject, 1),
|
|
13187
|
+
track = _localVideo$srcObject2[0];
|
|
13188
|
+
var capabilities = track.getCapabilities();
|
|
13189
|
+
var settings = track.getSettings();
|
|
13190
|
+
if (!('zoom' in settings)) {
|
|
13191
|
+
logger.info(LOG_PREFIX, "Zoom is not supported by " + track.label);
|
|
13192
|
+
zoom = null;
|
|
13193
|
+
} else {
|
|
13194
|
+
zoom = {
|
|
13195
|
+
min: capabilities.zoom.min,
|
|
13196
|
+
max: capabilities.zoom.max,
|
|
13197
|
+
step: capabilities.zoom.step,
|
|
13198
|
+
value: settings.zoom
|
|
13199
|
+
};
|
|
13200
|
+
}
|
|
13201
|
+
} else {
|
|
13202
|
+
zoom = null;
|
|
13203
|
+
}
|
|
13204
|
+
}
|
|
13205
|
+
return zoom;
|
|
13206
|
+
};
|
|
13207
|
+
var setZoom = /*#__PURE__*/function () {
|
|
13208
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(value) {
|
|
13209
|
+
var _localVideo$srcObject3, _localVideo$srcObject4, track;
|
|
13210
|
+
return _regenerator().w(function (_context) {
|
|
13211
|
+
while (1) switch (_context.n) {
|
|
13212
|
+
case 0:
|
|
13213
|
+
if (!zoom) {
|
|
13214
|
+
_context.n = 6;
|
|
13215
|
+
break;
|
|
13216
|
+
}
|
|
13217
|
+
if (!(value >= zoom.min && value <= zoom.max)) {
|
|
13218
|
+
_context.n = 4;
|
|
13219
|
+
break;
|
|
13220
|
+
}
|
|
13221
|
+
if (!(localVideo && localVideo.srcObject)) {
|
|
13222
|
+
_context.n = 2;
|
|
13223
|
+
break;
|
|
13224
|
+
}
|
|
13225
|
+
_localVideo$srcObject3 = localVideo.srcObject.getVideoTracks(), _localVideo$srcObject4 = _slicedToArray(_localVideo$srcObject3, 1), track = _localVideo$srcObject4[0];
|
|
13226
|
+
_context.n = 1;
|
|
13227
|
+
return track.applyConstraints({
|
|
13228
|
+
advanced: [{
|
|
13229
|
+
zoom: value
|
|
13230
|
+
}]
|
|
13231
|
+
});
|
|
13232
|
+
case 1:
|
|
13233
|
+
zoom.value = value;
|
|
13234
|
+
_context.n = 3;
|
|
13235
|
+
break;
|
|
13236
|
+
case 2:
|
|
13237
|
+
logger.warn(LOG_PREFIX, "Can't set zoom value: no local video");
|
|
13238
|
+
case 3:
|
|
13239
|
+
_context.n = 5;
|
|
13240
|
+
break;
|
|
13241
|
+
case 4:
|
|
13242
|
+
logger.info(LOG_PREFIX, "Zoom value " + value + "is out of range: " + zoom.min + "-" + zoom.max);
|
|
13243
|
+
case 5:
|
|
13244
|
+
_context.n = 7;
|
|
13245
|
+
break;
|
|
13246
|
+
case 6:
|
|
13247
|
+
logger.info(LOG_PREFIX, "Zoom is not supported or zoom capabilities unknown yet");
|
|
13248
|
+
case 7:
|
|
13249
|
+
return _context.a(2);
|
|
13250
|
+
}
|
|
13251
|
+
}, _callee);
|
|
13252
|
+
}));
|
|
13253
|
+
return function setZoom(_x) {
|
|
13254
|
+
return _ref.apply(this, arguments);
|
|
13255
|
+
};
|
|
13256
|
+
}();
|
|
13257
|
+
var getZoom = function getZoom() {
|
|
13258
|
+
if (zoom) {
|
|
13259
|
+
return zoom.value;
|
|
13260
|
+
}
|
|
13261
|
+
return -1;
|
|
13262
|
+
};
|
|
13110
13263
|
var exports = {};
|
|
13111
13264
|
exports.state = state;
|
|
13112
13265
|
exports.createOffer = createOffer;
|
|
@@ -13136,6 +13289,9 @@ var createConnection = function createConnection(options) {
|
|
|
13136
13289
|
exports.setPublishingBitrate = setPublishingBitrate;
|
|
13137
13290
|
exports.updateVideoSettings = updateVideoSettings;
|
|
13138
13291
|
exports.updateVideoResolution = updateVideoResolution;
|
|
13292
|
+
exports.getZoomCapabilities = getZoomCapabilities;
|
|
13293
|
+
exports.setZoom = setZoom;
|
|
13294
|
+
exports.getZoom = getZoom;
|
|
13139
13295
|
connections[id] = exports;
|
|
13140
13296
|
resolve(exports);
|
|
13141
13297
|
});
|