omnirtc-web 1.4.0 → 1.4.2-peiyou.0
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/dist/es-omnirtc-web.js +507 -498
- package/dist/omnirtc-web.js +511 -502
- package/package.json +2 -2
- package/src/omni.d.ts +10 -8
package/dist/es-omnirtc-web.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Agora from 'agora-rtc-sdk-ng';
|
|
2
1
|
import VERTC, { StreamIndex, MirrorType, VideoRenderMode, MediaType, VideoSourceType, AudioSourceType, ConnectionState, RTCAutoPlayPolicy } from '@volcengine/rtc';
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -84,168 +83,21 @@ var lib = function lib(token, options) {
|
|
|
84
83
|
var InvalidTokenError_1 = InvalidTokenError;
|
|
85
84
|
lib.InvalidTokenError = InvalidTokenError_1;
|
|
86
85
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
94
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
95
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
96
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
97
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
98
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
99
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
100
|
-
***************************************************************************** */
|
|
101
|
-
/* global Reflect, Promise */
|
|
102
|
-
|
|
103
|
-
var extendStatics = function(d, b) {
|
|
104
|
-
extendStatics = Object.setPrototypeOf ||
|
|
105
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
106
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
107
|
-
return extendStatics(d, b);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
function __extends(d, b) {
|
|
111
|
-
extendStatics(d, b);
|
|
112
|
-
function __() { this.constructor = d; }
|
|
113
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
var __assign = function() {
|
|
117
|
-
__assign = Object.assign || function __assign(t) {
|
|
118
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
119
|
-
s = arguments[i];
|
|
120
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
121
|
-
}
|
|
122
|
-
return t;
|
|
123
|
-
};
|
|
124
|
-
return __assign.apply(this, arguments);
|
|
86
|
+
var StaticConfig = {
|
|
87
|
+
agentVersion: "OmniRTC_Web_V1.4.2-peiyou.0",
|
|
88
|
+
logVersion: 1,
|
|
89
|
+
serviceType: 320,
|
|
90
|
+
logBackendUrl: "https://rtc-logs.magic-school.com/stream.gif"
|
|
125
91
|
};
|
|
126
|
-
|
|
127
|
-
function
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
136
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
137
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
138
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
139
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
140
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function __generator(thisArg, body) {
|
|
145
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
146
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
147
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
148
|
-
function step(op) {
|
|
149
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
150
|
-
while (_) try {
|
|
151
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
152
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
153
|
-
switch (op[0]) {
|
|
154
|
-
case 0: case 1: t = op; break;
|
|
155
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
156
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
157
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
158
|
-
default:
|
|
159
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
160
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
161
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
162
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
163
|
-
if (t[2]) _.ops.pop();
|
|
164
|
-
_.trys.pop(); continue;
|
|
165
|
-
}
|
|
166
|
-
op = body.call(thisArg, _);
|
|
167
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
168
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function __values(o) {
|
|
173
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
174
|
-
if (m) return m.call(o);
|
|
175
|
-
if (o && typeof o.length === "number") return {
|
|
176
|
-
next: function () {
|
|
177
|
-
if (o && i >= o.length) o = void 0;
|
|
178
|
-
return { value: o && o[i++], done: !o };
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function __read(o, n) {
|
|
185
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
186
|
-
if (!m) return o;
|
|
187
|
-
var i = m.call(o), r, ar = [], e;
|
|
188
|
-
try {
|
|
189
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
190
|
-
}
|
|
191
|
-
catch (error) { e = { error: error }; }
|
|
192
|
-
finally {
|
|
193
|
-
try {
|
|
194
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
195
|
-
}
|
|
196
|
-
finally { if (e) throw e.error; }
|
|
197
|
-
}
|
|
198
|
-
return ar;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
function __spread() {
|
|
202
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
203
|
-
ar = ar.concat(__read(arguments[i]));
|
|
204
|
-
return ar;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
var Tools = /** @class */ (function () {
|
|
208
|
-
function Tools() {
|
|
209
|
-
}
|
|
210
|
-
Tools.asyncSleep = function (timeMs) {
|
|
211
|
-
return new Promise(function (resolve) {
|
|
212
|
-
setTimeout(resolve, timeMs);
|
|
213
|
-
});
|
|
214
|
-
};
|
|
215
|
-
Tools.randomString = function (length) {
|
|
216
|
-
var result = '';
|
|
217
|
-
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
218
|
-
var charactersLength = characters.length;
|
|
219
|
-
for (var i = 0; i < length; i++) {
|
|
220
|
-
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
221
|
-
}
|
|
222
|
-
return result;
|
|
223
|
-
};
|
|
224
|
-
Tools.getDiffTimeMs = function (oldTime) {
|
|
225
|
-
return Date.now() - oldTime;
|
|
226
|
-
};
|
|
227
|
-
Tools.fetch = function (url, data, method) {
|
|
228
|
-
if (method === void 0) { method = 'POST'; }
|
|
229
|
-
return new Promise(function (resolve, reject) {
|
|
230
|
-
var xhr = new XMLHttpRequest();
|
|
231
|
-
xhr.timeout = 3000;
|
|
232
|
-
xhr.open(method, url);
|
|
233
|
-
xhr.onreadystatechange = function () {
|
|
234
|
-
if (xhr.readyState < 4) {
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
if (xhr.status > 199 && xhr.status < 300) {
|
|
238
|
-
resolve();
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
reject();
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
xhr.send(data);
|
|
245
|
-
});
|
|
246
|
-
};
|
|
247
|
-
return Tools;
|
|
248
|
-
}());
|
|
92
|
+
var RTCEngineType;
|
|
93
|
+
(function (RTCEngineType) {
|
|
94
|
+
RTCEngineType[RTCEngineType["Agora"] = 1] = "Agora";
|
|
95
|
+
RTCEngineType[RTCEngineType["Tencent"] = 2] = "Tencent";
|
|
96
|
+
RTCEngineType[RTCEngineType["XRTC"] = 3] = "XRTC";
|
|
97
|
+
RTCEngineType[RTCEngineType["Zego"] = 6] = "Zego";
|
|
98
|
+
RTCEngineType[RTCEngineType["Core"] = 7] = "Core";
|
|
99
|
+
RTCEngineType[RTCEngineType["VolcEngine"] = 8] = "VolcEngine";
|
|
100
|
+
})(RTCEngineType || (RTCEngineType = {}));
|
|
249
101
|
|
|
250
102
|
var global$1 = typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
|
|
251
103
|
|
|
@@ -2597,19 +2449,19 @@ validateRtpParameters(videoRtpParameters);var rtpParameters={mid:RTP_PROBATOR_MI
|
|
|
2597
2449
|
validateRtpParameters(rtpParameters);if(rtpParameters.codecs.length===0)return false;var firstMediaCodec=rtpParameters.codecs[0];return extendedRtpCapabilities.codecs.some(function(codec){return codec.remotePayloadType===firstMediaCodec.payloadType;});}var canReceive_1=canReceive;function isRtxCodec(codec){if(!codec)return false;return /.+\/rtx$/i.test(codec.mimeType);}function matchCodecs(aCodec,bCodec){var _ref8=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},_ref8$strict=_ref8.strict,strict=_ref8$strict===void 0?false:_ref8$strict,_ref8$modify=_ref8.modify,modify=_ref8$modify===void 0?false:_ref8$modify;var aMimeType=aCodec.mimeType.toLowerCase();var bMimeType=bCodec.mimeType.toLowerCase();if(aMimeType!==bMimeType)return false;if(aCodec.clockRate!==bCodec.clockRate)return false;if(aCodec.channels!==bCodec.channels)return false;// Per codec special checks.
|
|
2598
2450
|
switch(aMimeType){case'video/h264':{var aPacketizationMode=aCodec.parameters['packetization-mode']||0;var bPacketizationMode=bCodec.parameters['packetization-mode']||0;if(aPacketizationMode!==bPacketizationMode)return false;// If strict matching check profile-level-id.
|
|
2599
2451
|
if(strict){if(!h264ProfileLevelId.isSameProfile(aCodec.parameters,bCodec.parameters))return false;var selectedProfileLevelId;try{selectedProfileLevelId=h264ProfileLevelId.generateProfileLevelIdForAnswer(aCodec.parameters,bCodec.parameters);}catch(error){return false;}if(modify){if(selectedProfileLevelId){aCodec.parameters['profile-level-id']=selectedProfileLevelId;bCodec.parameters['profile-level-id']=selectedProfileLevelId;}else {delete aCodec.parameters['profile-level-id'];delete bCodec.parameters['profile-level-id'];}}}break;}case'video/vp9':{// If strict matching check profile-id.
|
|
2600
|
-
if(strict){var aProfileId=aCodec.parameters['profile-id']||0;var bProfileId=bCodec.parameters['profile-id']||0;if(aProfileId!==bProfileId)return false;}break;}}return true;}function matchHeaderExtensions(aExt,bExt){if(aExt.kind&&bExt.kind&&aExt.kind!==bExt.kind)return false;if(aExt.uri!==bExt.uri)return false;return true;}function reduceRtcpFeedback(codecA,codecB){var reducedRtcpFeedback=[];var _iterator21=_createForOfIteratorHelper$1(codecA.rtcpFeedback||[]),_step21;try{var _loop4=function _loop4(){var aFb=_step21.value;var matchingBFb=(codecB.rtcpFeedback||[]).find(function(bFb){return bFb.type===aFb.type&&(bFb.parameter===aFb.parameter||!bFb.parameter&&!aFb.parameter);});if(matchingBFb)reducedRtcpFeedback.push(matchingBFb);};for(_iterator21.s();!(_step21=_iterator21.n()).done;){_loop4();}}catch(err){_iterator21.e(err);}finally{_iterator21.f();}return reducedRtcpFeedback;}var ortc=/*#__PURE__*/Object.defineProperty({validateRtpCapabilities:validateRtpCapabilities_1,validateRtpCodecCapability:validateRtpCodecCapability_1,validateRtcpFeedback:validateRtcpFeedback_1,validateRtpHeaderExtension:validateRtpHeaderExtension_1,validateRtpParameters:validateRtpParameters_1,validateRtpCodecParameters:validateRtpCodecParameters_1,validateRtpHeaderExtensionParameters:validateRtpHeaderExtensionParameters_1,validateRtpEncodingParameters:validateRtpEncodingParameters_1,validateRtcpParameters:validateRtcpParameters_1,validateSctpCapabilities:validateSctpCapabilities_1,validateNumSctpStreams:validateNumSctpStreams_1,validateSctpParameters:validateSctpParameters_1,validateSctpStreamParameters:validateSctpStreamParameters_1,getExtendedRtpCapabilities:getExtendedRtpCapabilities_1,getRecvRtpCapabilities:getRecvRtpCapabilities_1,getSendingRtpParameters:getSendingRtpParameters_1,getSendingRemoteRtpParameters:getSendingRemoteRtpParameters_1,reduceCodecs:reduceCodecs_1,generateProbatorRtpParameters:generateProbatorRtpParameters_1,canSend:canSend_1,canReceive:canReceive_1},'__esModule',{value:true});var __awaiter
|
|
2452
|
+
if(strict){var aProfileId=aCodec.parameters['profile-id']||0;var bProfileId=bCodec.parameters['profile-id']||0;if(aProfileId!==bProfileId)return false;}break;}}return true;}function matchHeaderExtensions(aExt,bExt){if(aExt.kind&&bExt.kind&&aExt.kind!==bExt.kind)return false;if(aExt.uri!==bExt.uri)return false;return true;}function reduceRtcpFeedback(codecA,codecB){var reducedRtcpFeedback=[];var _iterator21=_createForOfIteratorHelper$1(codecA.rtcpFeedback||[]),_step21;try{var _loop4=function _loop4(){var aFb=_step21.value;var matchingBFb=(codecB.rtcpFeedback||[]).find(function(bFb){return bFb.type===aFb.type&&(bFb.parameter===aFb.parameter||!bFb.parameter&&!aFb.parameter);});if(matchingBFb)reducedRtcpFeedback.push(matchingBFb);};for(_iterator21.s();!(_step21=_iterator21.n()).done;){_loop4();}}catch(err){_iterator21.e(err);}finally{_iterator21.f();}return reducedRtcpFeedback;}var ortc=/*#__PURE__*/Object.defineProperty({validateRtpCapabilities:validateRtpCapabilities_1,validateRtpCodecCapability:validateRtpCodecCapability_1,validateRtcpFeedback:validateRtcpFeedback_1,validateRtpHeaderExtension:validateRtpHeaderExtension_1,validateRtpParameters:validateRtpParameters_1,validateRtpCodecParameters:validateRtpCodecParameters_1,validateRtpHeaderExtensionParameters:validateRtpHeaderExtensionParameters_1,validateRtpEncodingParameters:validateRtpEncodingParameters_1,validateRtcpParameters:validateRtcpParameters_1,validateSctpCapabilities:validateSctpCapabilities_1,validateNumSctpStreams:validateNumSctpStreams_1,validateSctpParameters:validateSctpParameters_1,validateSctpStreamParameters:validateSctpStreamParameters_1,getExtendedRtpCapabilities:getExtendedRtpCapabilities_1,getRecvRtpCapabilities:getRecvRtpCapabilities_1,getSendingRtpParameters:getSendingRtpParameters_1,getSendingRemoteRtpParameters:getSendingRemoteRtpParameters_1,reduceCodecs:reduceCodecs_1,generateProbatorRtpParameters:generateProbatorRtpParameters_1,canSend:canSend_1,canReceive:canReceive_1},'__esModule',{value:true});var __awaiter=commonjsGlobal$1&&commonjsGlobal$1.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value);});}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value));}catch(e){reject(e);}}function rejected(value){try{step(generator["throw"](value));}catch(e){reject(e);}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected);}step((generator=generator.apply(thisArg,_arguments||[])).next());});};var AwaitQueue=/*#__PURE__*/function(){function AwaitQueue(){_classCallCheck(this,AwaitQueue);var _ref9=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{ClosedErrorClass:Error,StoppedErrorClass:Error,RemovedTaskErrorClass:Error},_ref9$ClosedErrorClas=_ref9.ClosedErrorClass,ClosedErrorClass=_ref9$ClosedErrorClas===void 0?Error:_ref9$ClosedErrorClas,_ref9$StoppedErrorCla=_ref9.StoppedErrorClass,StoppedErrorClass=_ref9$StoppedErrorCla===void 0?Error:_ref9$StoppedErrorCla,_ref9$RemovedTaskErro=_ref9.RemovedTaskErrorClass,RemovedTaskErrorClass=_ref9$RemovedTaskErro===void 0?Error:_ref9$RemovedTaskErro;// Closed flag.
|
|
2601
2453
|
this.closed=false;// Queue of pending tasks.
|
|
2602
2454
|
this.pendingTasks=[];// Error class used when rejecting a task due to AwaitQueue being closed.
|
|
2603
2455
|
this.ClosedErrorClass=Error;// Error class used when rejecting a task due to AwaitQueue being stopped.
|
|
2604
2456
|
this.StoppedErrorClass=Error;// Error class used when removing a pending task when calling removeTask().
|
|
2605
2457
|
this.RemovedTaskErrorClass=Error;this.ClosedErrorClass=ClosedErrorClass;this.StoppedErrorClass=StoppedErrorClass;this.RemovedTaskErrorClass=RemovedTaskErrorClass;}return _createClass(AwaitQueue,[{key:"size",get:function get(){return this.pendingTasks.length;}},{key:"close",value:function close(){if(this.closed)return;this.closed=true;var _iterator22=_createForOfIteratorHelper$1(this.pendingTasks),_step22;try{for(_iterator22.s();!(_step22=_iterator22.n()).done;){var pendingTask=_step22.value;pendingTask.stopped=true;pendingTask.reject(new this.ClosedErrorClass('AwaitQueue closed'));}// Enpty the pending tasks array.
|
|
2606
|
-
}catch(err){_iterator22.e(err);}finally{_iterator22.f();}this.pendingTasks.length=0;}},{key:"push",value:function push(task,name){return __awaiter
|
|
2458
|
+
}catch(err){_iterator22.e(err);}finally{_iterator22.f();}this.pendingTasks.length=0;}},{key:"push",value:function push(task,name){return __awaiter(this,void 0,void 0,/*#__PURE__*/regenerator.mark(function _callee6(){var _this38=this;return regenerator.wrap(function _callee6$(_context7){while(1)switch(_context7.prev=_context7.next){case 0:if(!this.closed){_context7.next=2;break;}throw new this.ClosedErrorClass('AwaitQueue closed');case 2:if(!(typeof task!=='function')){_context7.next=4;break;}throw new TypeError('given task is not a function');case 4:if(!task.name&&name){try{Object.defineProperty(task,'name',{value:name});}catch(error){}}return _context7.abrupt("return",new Promise(function(resolve,reject){var pendingTask={task:task,name:name,resolve:resolve,reject:reject,stopped:false,enqueuedAt:new Date(),executedAt:undefined};// Append task to the queue.
|
|
2607
2459
|
_this38.pendingTasks.push(pendingTask);// And run it if this is the only task in the queue.
|
|
2608
2460
|
if(_this38.pendingTasks.length===1)_this38.next();}));case 6:case"end":return _context7.stop();}},_callee6,this);}));}},{key:"removeTask",value:function removeTask(idx){if(idx===0){throw new TypeError('cannot remove task with index 0');}var pendingTask=this.pendingTasks[idx];if(!pendingTask)return;this.pendingTasks.splice(idx,1);pendingTask.reject(new this.RemovedTaskErrorClass('task removed from the queue'));}},{key:"stop",value:function stop(){if(this.closed)return;var _iterator23=_createForOfIteratorHelper$1(this.pendingTasks),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var pendingTask=_step23.value;pendingTask.stopped=true;pendingTask.reject(new this.StoppedErrorClass('AwaitQueue stopped'));}// Enpty the pending tasks array.
|
|
2609
|
-
}catch(err){_iterator23.e(err);}finally{_iterator23.f();}this.pendingTasks.length=0;}},{key:"dump",value:function dump(){var now=new Date();var idx=0;return this.pendingTasks.map(function(pendingTask){return {idx:idx++,task:pendingTask.task,name:pendingTask.name,enqueuedTime:pendingTask.executedAt?pendingTask.executedAt.getTime()-pendingTask.enqueuedAt.getTime():now.getTime()-pendingTask.enqueuedAt.getTime(),executingTime:pendingTask.executedAt?now.getTime()-pendingTask.executedAt.getTime():0};});}},{key:"next",value:function next(){return __awaiter
|
|
2461
|
+
}catch(err){_iterator23.e(err);}finally{_iterator23.f();}this.pendingTasks.length=0;}},{key:"dump",value:function dump(){var now=new Date();var idx=0;return this.pendingTasks.map(function(pendingTask){return {idx:idx++,task:pendingTask.task,name:pendingTask.name,enqueuedTime:pendingTask.executedAt?pendingTask.executedAt.getTime()-pendingTask.enqueuedAt.getTime():now.getTime()-pendingTask.enqueuedAt.getTime(),executingTime:pendingTask.executedAt?now.getTime()-pendingTask.executedAt.getTime():0};});}},{key:"next",value:function next(){return __awaiter(this,void 0,void 0,/*#__PURE__*/regenerator.mark(function _callee7(){var pendingTask;return regenerator.wrap(function _callee7$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:// Take the first pending task.
|
|
2610
2462
|
pendingTask=this.pendingTasks[0];if(pendingTask){_context8.next=3;break;}return _context8.abrupt("return");case 3:_context8.next=5;return this.executeTask(pendingTask);case 5:// Remove the first pending task (the completed one) from the queue.
|
|
2611
2463
|
this.pendingTasks.shift();// And continue.
|
|
2612
|
-
this.next();case 7:case"end":return _context8.stop();}},_callee7,this);}));}},{key:"executeTask",value:function executeTask(pendingTask){return __awaiter
|
|
2464
|
+
this.next();case 7:case"end":return _context8.stop();}},_callee7,this);}));}},{key:"executeTask",value:function executeTask(pendingTask){return __awaiter(this,void 0,void 0,/*#__PURE__*/regenerator.mark(function _callee8(){var result;return regenerator.wrap(function _callee8$(_context9){while(1)switch(_context9.prev=_context9.next){case 0:if(!pendingTask.stopped){_context9.next=2;break;}return _context9.abrupt("return");case 2:pendingTask.executedAt=new Date();_context9.prev=3;_context9.next=6;return pendingTask.task();case 6:result=_context9.sent;if(!pendingTask.stopped){_context9.next=9;break;}return _context9.abrupt("return");case 9:// Resolve the task with the returned result (if any).
|
|
2613
2465
|
pendingTask.resolve(result);_context9.next=17;break;case 12:_context9.prev=12;_context9.t0=_context9["catch"](3);if(!pendingTask.stopped){_context9.next=16;break;}return _context9.abrupt("return");case 16:// Reject the task with its own error.
|
|
2614
2466
|
pendingTask.reject(_context9.t0);case 17:case"end":return _context9.stop();}},_callee8,null,[[3,12]]);}));}}]);}();var AwaitQueue_1=AwaitQueue;var lib$1=/*#__PURE__*/Object.defineProperty({AwaitQueue:AwaitQueue_1},'__esModule',{value:true});var logger$f=new Logger_1.Logger('Producer');var Producer=/*#__PURE__*/function(_EnhancedEventEmitter3){/**
|
|
2615
2467
|
* @emits transportclose
|
|
@@ -6181,21 +6033,187 @@ _stream.addTrack(track.track);context=getAudioContext();source=context.createMed
|
|
|
6181
6033
|
* @ignore
|
|
6182
6034
|
*/function getAudioBuffer(source,cacheOnlineFile){return __awaiter$1(this,void 0,void 0,/*#__PURE__*/regenerator.mark(function _callee254(){var arrayBuffer,cacheAudioBuffer,getFileArrayBuffer,audioBuffer;return regenerator.wrap(function _callee254$(_context255){while(1)switch(_context255.prev=_context255.next){case 0:if(!('string'==typeof source)){_context255.next=15;break;}cacheAudioBuffer=cacheMap.get(source);if(!cacheAudioBuffer){_context255.next=4;break;}return _context255.abrupt("return",cacheAudioBuffer);case 4:_context255.prev=4;_context255.next=7;return getStringArrayBuffer(source);case 7:arrayBuffer=_context255.sent;_context255.next=13;break;case 10:_context255.prev=10;_context255.t0=_context255["catch"](4);throw new CoreRTCError(CoreRTCErrorCode.CHECK_VIDEO_TRACK_ERROR,typeof _context255.t0==='string'?_context255.t0:'fetch audio file failed');case 13:_context255.next=19;break;case 15:getFileArrayBuffer=new Promise(function(resolve,reject){var fileReader=new FileReader();fileReader.addEventListener('load',function(res){if(res.target){resolve(res.target.result);}else {reject(new CoreRTCError(CoreRTCErrorCode.READ_LOCAL_AUDIO_FILE_ERROR,'read local audio file error'));}});fileReader.addEventListener('error',function(){reject(new CoreRTCError(CoreRTCErrorCode.READ_LOCAL_AUDIO_FILE_ERROR,'read local audio file error'));});fileReader.readAsArrayBuffer(source);});_context255.next=18;return getFileArrayBuffer;case 18:arrayBuffer=_context255.sent;case 19:_context255.next=21;return decodeAudioData(arrayBuffer);case 21:audioBuffer=_context255.sent;if('string'==typeof source&&cacheOnlineFile)cacheMap.set(source,audioBuffer);return _context255.abrupt("return",audioBuffer);case 24:case"end":return _context255.stop();}},_callee254,null,[[4,10]]);}));}
|
|
6183
6035
|
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6036
|
+
/*! *****************************************************************************
|
|
6037
|
+
Copyright (c) Microsoft Corporation.
|
|
6038
|
+
|
|
6039
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6040
|
+
purpose with or without fee is hereby granted.
|
|
6041
|
+
|
|
6042
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
6043
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
6044
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
6045
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
6046
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
6047
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
6048
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
6049
|
+
***************************************************************************** */
|
|
6050
|
+
/* global Reflect, Promise */
|
|
6051
|
+
|
|
6052
|
+
var extendStatics = function(d, b) {
|
|
6053
|
+
extendStatics = Object.setPrototypeOf ||
|
|
6054
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6055
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6056
|
+
return extendStatics(d, b);
|
|
6057
|
+
};
|
|
6058
|
+
|
|
6059
|
+
function __extends(d, b) {
|
|
6060
|
+
extendStatics(d, b);
|
|
6061
|
+
function __() { this.constructor = d; }
|
|
6062
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
6063
|
+
}
|
|
6064
|
+
|
|
6065
|
+
var __assign = function() {
|
|
6066
|
+
__assign = Object.assign || function __assign(t) {
|
|
6067
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6068
|
+
s = arguments[i];
|
|
6069
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6070
|
+
}
|
|
6071
|
+
return t;
|
|
6072
|
+
};
|
|
6073
|
+
return __assign.apply(this, arguments);
|
|
6074
|
+
};
|
|
6075
|
+
|
|
6076
|
+
function __decorate(decorators, target, key, desc) {
|
|
6077
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6078
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6079
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6080
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6081
|
+
}
|
|
6082
|
+
|
|
6083
|
+
function __awaiter$2(thisArg, _arguments, P, generator) {
|
|
6084
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6085
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6086
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6087
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6088
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6089
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6090
|
+
});
|
|
6091
|
+
}
|
|
6092
|
+
|
|
6093
|
+
function __generator(thisArg, body) {
|
|
6094
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
6095
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
6096
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
6097
|
+
function step(op) {
|
|
6098
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
6099
|
+
while (_) try {
|
|
6100
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
6101
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
6102
|
+
switch (op[0]) {
|
|
6103
|
+
case 0: case 1: t = op; break;
|
|
6104
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
6105
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
6106
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
6107
|
+
default:
|
|
6108
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
6109
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
6110
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
6111
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
6112
|
+
if (t[2]) _.ops.pop();
|
|
6113
|
+
_.trys.pop(); continue;
|
|
6114
|
+
}
|
|
6115
|
+
op = body.call(thisArg, _);
|
|
6116
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
6117
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
6118
|
+
}
|
|
6119
|
+
}
|
|
6120
|
+
|
|
6121
|
+
function __values(o) {
|
|
6122
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
6123
|
+
if (m) return m.call(o);
|
|
6124
|
+
if (o && typeof o.length === "number") return {
|
|
6125
|
+
next: function () {
|
|
6126
|
+
if (o && i >= o.length) o = void 0;
|
|
6127
|
+
return { value: o && o[i++], done: !o };
|
|
6128
|
+
}
|
|
6129
|
+
};
|
|
6130
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
6131
|
+
}
|
|
6132
|
+
|
|
6133
|
+
function __read(o, n) {
|
|
6134
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
6135
|
+
if (!m) return o;
|
|
6136
|
+
var i = m.call(o), r, ar = [], e;
|
|
6137
|
+
try {
|
|
6138
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
6139
|
+
}
|
|
6140
|
+
catch (error) { e = { error: error }; }
|
|
6141
|
+
finally {
|
|
6142
|
+
try {
|
|
6143
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
6144
|
+
}
|
|
6145
|
+
finally { if (e) throw e.error; }
|
|
6146
|
+
}
|
|
6147
|
+
return ar;
|
|
6148
|
+
}
|
|
6149
|
+
|
|
6150
|
+
function __spread() {
|
|
6151
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
6152
|
+
ar = ar.concat(__read(arguments[i]));
|
|
6153
|
+
return ar;
|
|
6154
|
+
}
|
|
6155
|
+
|
|
6156
|
+
var defineProperty = createCommonjsModule(function (module) {
|
|
6157
|
+
function _defineProperty(e, r, t) {
|
|
6158
|
+
return (r = toPropertyKey_1(r)) in e ? Object.defineProperty(e, r, {
|
|
6159
|
+
value: t,
|
|
6160
|
+
enumerable: !0,
|
|
6161
|
+
configurable: !0,
|
|
6162
|
+
writable: !0
|
|
6163
|
+
}) : e[r] = t, e;
|
|
6164
|
+
}
|
|
6165
|
+
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
6166
|
+
});
|
|
6167
|
+
var _defineProperty = /*@__PURE__*/getDefaultExportFromCjs(defineProperty);
|
|
6168
|
+
|
|
6169
|
+
var AgoraRTC = /*#__PURE__*/_createClass(function AgoraRTC() {
|
|
6170
|
+
_classCallCheck(this, AgoraRTC);
|
|
6171
|
+
throw new Error('AgoraRTC is not available in this environment.');
|
|
6172
|
+
});
|
|
6173
|
+
_defineProperty(AgoraRTC, "VERSION", null);
|
|
6174
|
+
|
|
6175
|
+
var Tools = /** @class */ (function () {
|
|
6176
|
+
function Tools() {
|
|
6177
|
+
}
|
|
6178
|
+
Tools.asyncSleep = function (timeMs) {
|
|
6179
|
+
return new Promise(function (resolve) {
|
|
6180
|
+
setTimeout(resolve, timeMs);
|
|
6181
|
+
});
|
|
6182
|
+
};
|
|
6183
|
+
Tools.randomString = function (length) {
|
|
6184
|
+
var result = '';
|
|
6185
|
+
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
6186
|
+
var charactersLength = characters.length;
|
|
6187
|
+
for (var i = 0; i < length; i++) {
|
|
6188
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
6189
|
+
}
|
|
6190
|
+
return result;
|
|
6191
|
+
};
|
|
6192
|
+
Tools.getDiffTimeMs = function (oldTime) {
|
|
6193
|
+
return Date.now() - oldTime;
|
|
6194
|
+
};
|
|
6195
|
+
Tools.fetch = function (url, data, method) {
|
|
6196
|
+
if (method === void 0) { method = 'POST'; }
|
|
6197
|
+
return new Promise(function (resolve, reject) {
|
|
6198
|
+
var xhr = new XMLHttpRequest();
|
|
6199
|
+
xhr.timeout = 3000;
|
|
6200
|
+
xhr.open(method, url);
|
|
6201
|
+
xhr.onreadystatechange = function () {
|
|
6202
|
+
if (xhr.readyState < 4) {
|
|
6203
|
+
return;
|
|
6204
|
+
}
|
|
6205
|
+
if (xhr.status > 199 && xhr.status < 300) {
|
|
6206
|
+
resolve();
|
|
6207
|
+
}
|
|
6208
|
+
else {
|
|
6209
|
+
reject();
|
|
6210
|
+
}
|
|
6211
|
+
};
|
|
6212
|
+
xhr.send(data);
|
|
6213
|
+
});
|
|
6214
|
+
};
|
|
6215
|
+
return Tools;
|
|
6216
|
+
}());
|
|
6199
6217
|
|
|
6200
6218
|
var eventemitter3 = createCommonjsModule(function (module) {
|
|
6201
6219
|
|
|
@@ -6669,7 +6687,7 @@ var StatisticDynamicHelper = /** @class */ (function (_super) {
|
|
|
6669
6687
|
}
|
|
6670
6688
|
};
|
|
6671
6689
|
StatisticDynamicHelper.prototype.getStatsLoop = function () {
|
|
6672
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
6690
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
6673
6691
|
var _this = this;
|
|
6674
6692
|
return __generator(this, function (_a) {
|
|
6675
6693
|
switch (_a.label) {
|
|
@@ -6698,7 +6716,7 @@ var StatisticDynamicHelper = /** @class */ (function (_super) {
|
|
|
6698
6716
|
});
|
|
6699
6717
|
};
|
|
6700
6718
|
StatisticDynamicHelper.prototype.startMainLoop = function () {
|
|
6701
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
6719
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
6702
6720
|
var localStats, videoStats, audioStats, avgStatsMap, _a, _b, _c, senderId, audioArray, remoteAudioStats, _d, _e, _f, senderId, videoArray, remoteVideoStats, remoteStatsArray, _g, _h, senderId, value;
|
|
6703
6721
|
var e_1, _j, e_2, _k, e_3, _l;
|
|
6704
6722
|
return __generator(this, function (_m) {
|
|
@@ -8144,7 +8162,7 @@ var StatisticLog = /** @class */ (function (_super) {
|
|
|
8144
8162
|
this.sendQueue.push(frame);
|
|
8145
8163
|
};
|
|
8146
8164
|
StatisticLog.prototype.run = function () {
|
|
8147
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
8165
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
8148
8166
|
var frame;
|
|
8149
8167
|
var _this = this;
|
|
8150
8168
|
return __generator(this, function (_a) {
|
|
@@ -8242,7 +8260,7 @@ var LogFrame = /** @class */ (function (_super) {
|
|
|
8242
8260
|
};
|
|
8243
8261
|
};
|
|
8244
8262
|
LogFrame.prototype.send = function (publicUserInfo, commonInfo) {
|
|
8245
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
8263
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
8246
8264
|
var success, data, e_1;
|
|
8247
8265
|
return __generator(this, function (_a) {
|
|
8248
8266
|
switch (_a.label) {
|
|
@@ -8299,36 +8317,74 @@ function getStreamLogType(audio, video) {
|
|
|
8299
8317
|
}
|
|
8300
8318
|
}
|
|
8301
8319
|
|
|
8302
|
-
var
|
|
8320
|
+
var Emitter = /** @class */ (function () {
|
|
8321
|
+
function Emitter() {
|
|
8322
|
+
this._emitter = new eventemitter3();
|
|
8323
|
+
}
|
|
8324
|
+
Emitter.prototype.on = function (event, listener) {
|
|
8325
|
+
this._emitter.on(event, listener);
|
|
8326
|
+
};
|
|
8327
|
+
Emitter.prototype.once = function (event, listener) {
|
|
8328
|
+
this._emitter.once(event, listener);
|
|
8329
|
+
};
|
|
8330
|
+
Emitter.prototype.off = function (event, listener) {
|
|
8331
|
+
this._emitter.off(event, listener);
|
|
8332
|
+
};
|
|
8333
|
+
Emitter.prototype.removeAllListeners = function (event) {
|
|
8334
|
+
this._emitter.removeAllListeners(event);
|
|
8335
|
+
};
|
|
8336
|
+
Emitter.prototype.getListeners = function (event) {
|
|
8337
|
+
return this._emitter.listeners(event);
|
|
8338
|
+
};
|
|
8339
|
+
Emitter.prototype.emit = function (event) {
|
|
8340
|
+
var _a;
|
|
8341
|
+
var args = [];
|
|
8342
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
8343
|
+
args[_i - 1] = arguments[_i];
|
|
8344
|
+
}
|
|
8345
|
+
(_a = this._emitter).emit.apply(_a, __spread([event], args));
|
|
8346
|
+
};
|
|
8347
|
+
return Emitter;
|
|
8348
|
+
}());
|
|
8349
|
+
|
|
8350
|
+
var Client = /** @class */ (function (_super) {
|
|
8351
|
+
__extends(Client, _super);
|
|
8303
8352
|
function Client(client, _a) {
|
|
8304
|
-
var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, token = _a.token, type = _a.type, plan = _a.plan;
|
|
8305
|
-
|
|
8306
|
-
|
|
8353
|
+
var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, token = _a.token, type = _a.type, prefix = _a.prefix, plan = _a.plan;
|
|
8354
|
+
var _this = _super.call(this) || this;
|
|
8355
|
+
_this._reconnectTimestamp = 0; // 开始重连的时间戳
|
|
8356
|
+
_this._reconnectTimes = 0; // 重连次数
|
|
8357
|
+
_this._userMap = new Map();
|
|
8307
8358
|
// for log
|
|
8308
|
-
|
|
8309
|
-
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
|
|
8316
|
-
|
|
8359
|
+
_this.roomState = 'init';
|
|
8360
|
+
_this._appId = appId;
|
|
8361
|
+
_this._roomId = roomId;
|
|
8362
|
+
_this._userId = userId;
|
|
8363
|
+
_this._token = token;
|
|
8364
|
+
_this._client = client;
|
|
8365
|
+
_this._type = type;
|
|
8366
|
+
_this._plan = plan;
|
|
8367
|
+
_this._statisticLog = new StatisticLog();
|
|
8368
|
+
_this._prefix = prefix;
|
|
8317
8369
|
switch (type) {
|
|
8318
8370
|
case RTCEngineType.Agora:
|
|
8319
|
-
|
|
8371
|
+
_this._engineVersion = AgoraRTC.VERSION;
|
|
8320
8372
|
break;
|
|
8321
8373
|
case RTCEngineType.Core:
|
|
8322
|
-
|
|
8374
|
+
_this._engineVersion = coreRTC.VERSION;
|
|
8323
8375
|
break;
|
|
8324
8376
|
case RTCEngineType.VolcEngine:
|
|
8325
|
-
|
|
8377
|
+
_this._engineVersion = VERTC.getSdkVersion();
|
|
8326
8378
|
break;
|
|
8379
|
+
// case RTCEngineType.Agora:
|
|
8380
|
+
// this._engineVersion = Agora.VERSION;
|
|
8381
|
+
// break;
|
|
8327
8382
|
default:
|
|
8328
|
-
|
|
8383
|
+
_this._engineVersion = null;
|
|
8329
8384
|
break;
|
|
8330
8385
|
}
|
|
8331
|
-
bindListeners(
|
|
8386
|
+
_this.bindListeners();
|
|
8387
|
+
return _this;
|
|
8332
8388
|
}
|
|
8333
8389
|
Object.defineProperty(Client.prototype, "connectionState", {
|
|
8334
8390
|
get: function () {
|
|
@@ -8365,21 +8421,6 @@ var Client = /** @class */ (function () {
|
|
|
8365
8421
|
enumerable: false,
|
|
8366
8422
|
configurable: true
|
|
8367
8423
|
});
|
|
8368
|
-
Client.prototype.on = function (event, listener) {
|
|
8369
|
-
return this._client.on(event, listener);
|
|
8370
|
-
};
|
|
8371
|
-
Client.prototype.once = function (event, listener) {
|
|
8372
|
-
return this._client.once(event, listener);
|
|
8373
|
-
};
|
|
8374
|
-
Client.prototype.off = function (event, listener) {
|
|
8375
|
-
return this._client.off(event, listener);
|
|
8376
|
-
};
|
|
8377
|
-
Client.prototype.removeAllListeners = function (event) {
|
|
8378
|
-
this._client.removeAllListeners(event);
|
|
8379
|
-
if (!event || event === 'connection-state-change') {
|
|
8380
|
-
bindListeners(this);
|
|
8381
|
-
}
|
|
8382
|
-
};
|
|
8383
8424
|
Client.prototype.join = function () {
|
|
8384
8425
|
var _this = this;
|
|
8385
8426
|
// @ts-ignore
|
|
@@ -8472,7 +8513,7 @@ var Client = /** @class */ (function () {
|
|
|
8472
8513
|
});
|
|
8473
8514
|
};
|
|
8474
8515
|
Client.prototype.unpublish = function (tracks) {
|
|
8475
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
8516
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
8476
8517
|
var localTracks;
|
|
8477
8518
|
var _this = this;
|
|
8478
8519
|
return __generator(this, function (_a) {
|
|
@@ -8498,10 +8539,14 @@ var Client = /** @class */ (function () {
|
|
|
8498
8539
|
});
|
|
8499
8540
|
});
|
|
8500
8541
|
};
|
|
8501
|
-
|
|
8542
|
+
// @ts-ignore
|
|
8543
|
+
Client.prototype.subscribe = function (streamId, mediaType) {
|
|
8502
8544
|
var _this = this;
|
|
8503
8545
|
var startTime = Date.now();
|
|
8504
|
-
|
|
8546
|
+
var user = this._userMap.get(streamId);
|
|
8547
|
+
var flag = streamId.split('_')[3];
|
|
8548
|
+
// @ts-ignore
|
|
8549
|
+
return this._client.subscribe(user, mediaType, flag).then(function (track) {
|
|
8505
8550
|
track.on('first-frame-decoded', function () {
|
|
8506
8551
|
_this._statisticLog.emit('first-frame', FirstFrame[track.trackMediaType], track.getUserId());
|
|
8507
8552
|
});
|
|
@@ -8544,9 +8589,12 @@ var Client = /** @class */ (function () {
|
|
|
8544
8589
|
return track;
|
|
8545
8590
|
});
|
|
8546
8591
|
};
|
|
8547
|
-
Client.prototype.unsubscribe = function (
|
|
8592
|
+
Client.prototype.unsubscribe = function (streamId, mediaType) {
|
|
8548
8593
|
var _this = this;
|
|
8549
|
-
|
|
8594
|
+
var user = this._userMap.get(streamId);
|
|
8595
|
+
var flag = streamId.split('_')[3];
|
|
8596
|
+
// @ts-ignore
|
|
8597
|
+
return this._client.unsubscribe(user, mediaType, flag).then(function () {
|
|
8550
8598
|
_this._statisticLog.emit('unsubscribed', null, mediaType === 'audio', mediaType === 'video', user.uid);
|
|
8551
8599
|
return;
|
|
8552
8600
|
});
|
|
@@ -8635,191 +8683,114 @@ var Client = /** @class */ (function () {
|
|
|
8635
8683
|
Client.prototype.getRemoteVideoStats = function () {
|
|
8636
8684
|
return this._client.getRemoteVideoStats();
|
|
8637
8685
|
};
|
|
8638
|
-
Client.prototype.
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8686
|
+
Client.prototype.bindListeners = function () {
|
|
8687
|
+
var _this = this;
|
|
8688
|
+
this._client.on('connection-state-change', function (curState, revState, msg) {
|
|
8689
|
+
if (curState === 'DISCONNECTED') {
|
|
8690
|
+
var reason = '', stateReason = '';
|
|
8691
|
+
switch (msg) {
|
|
8692
|
+
case 'SERVER_ERROR':
|
|
8693
|
+
case 'NETWORK_ERROR': {
|
|
8694
|
+
reason = StatisticLog.DisconnectReason.NETWORK;
|
|
8695
|
+
stateReason = 'interrupted';
|
|
8696
|
+
break;
|
|
8697
|
+
}
|
|
8698
|
+
case 'LEAVE': {
|
|
8699
|
+
reason = StatisticLog.DisconnectReason.CLIENT;
|
|
8700
|
+
stateReason = 'leave_channel';
|
|
8701
|
+
break;
|
|
8702
|
+
}
|
|
8703
|
+
case 'IP_BANNED':
|
|
8704
|
+
case 'CHANNEL_BANNED':
|
|
8705
|
+
case 'UID_BANNED': {
|
|
8706
|
+
reason = StatisticLog.DisconnectReason.SERVER;
|
|
8707
|
+
stateReason = 'banned_by_server';
|
|
8708
|
+
break;
|
|
8709
|
+
}
|
|
8658
8710
|
}
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
stateReason = 'banned_by_server';
|
|
8664
|
-
break;
|
|
8711
|
+
_this._statisticLog.emit('connection-state', OmniConnectionState.Disconnected, stateReason);
|
|
8712
|
+
_this._statisticLog.emit('disconnected', reason, '');
|
|
8713
|
+
if (_this._statisticLog && reason !== StatisticLog.DisconnectReason.NETWORK) {
|
|
8714
|
+
_this._statisticLog.stop();
|
|
8665
8715
|
}
|
|
8666
8716
|
}
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
client._statisticLog.stop();
|
|
8717
|
+
if (curState === 'RECONNECTING') {
|
|
8718
|
+
_this._reconnectTimestamp = Date.now();
|
|
8719
|
+
_this._reconnectTimes += 1;
|
|
8671
8720
|
}
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
}
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
|
|
8695
|
-
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8721
|
+
if (curState === 'CONNECTED' && revState === 'RECONNECTING') {
|
|
8722
|
+
_this._statisticLog.emit('joined', false, 0, 1);
|
|
8723
|
+
_this._statisticLog.emit('reconnected', _this._reconnectTimestamp, Date.now(), _this._reconnectTimes);
|
|
8724
|
+
}
|
|
8725
|
+
_this.emit('connection-state-change', curState, msg);
|
|
8726
|
+
});
|
|
8727
|
+
this._client.on('user-joined', function (user) {
|
|
8728
|
+
_this.emit('user-joined', user);
|
|
8729
|
+
});
|
|
8730
|
+
this._client.on('user-left', function (user, reason) {
|
|
8731
|
+
_this.emit('user-left', user, reason);
|
|
8732
|
+
});
|
|
8733
|
+
this._client.on('user-published', function (user, mediaType, flag) {
|
|
8734
|
+
var userId = user.uid;
|
|
8735
|
+
if (_this._type === RTCEngineType.Agora) {
|
|
8736
|
+
flag = streamFlagMap[userId >>> 30];
|
|
8737
|
+
userId = parseAgoraUserId(userId, flag);
|
|
8738
|
+
}
|
|
8739
|
+
if (_this._type === RTCEngineType.Core) {
|
|
8740
|
+
flag = 'main';
|
|
8741
|
+
}
|
|
8742
|
+
var streamId = _this._prefix + "_" + _this._roomId + "_" + userId + "_" + flag;
|
|
8743
|
+
_this._userMap.set(streamId, user);
|
|
8744
|
+
// @ts-ignore
|
|
8745
|
+
_this.emit('user-published', user, mediaType, streamId);
|
|
8746
|
+
});
|
|
8747
|
+
this._client.on('user-unpublished', function (user, mediaType, flag) {
|
|
8748
|
+
var userId = user.uid;
|
|
8749
|
+
if (_this._type === RTCEngineType.Agora) {
|
|
8750
|
+
flag = streamFlagMap[userId >>> 30];
|
|
8751
|
+
userId = parseAgoraUserId(userId, flag);
|
|
8752
|
+
}
|
|
8753
|
+
if (_this._type === RTCEngineType.Core) {
|
|
8754
|
+
flag = 'main';
|
|
8755
|
+
}
|
|
8756
|
+
var streamId = _this._prefix + "_" + _this._roomId + "_" + userId + "_" + flag;
|
|
8757
|
+
_this._userMap.delete(streamId);
|
|
8758
|
+
// @ts-ignore
|
|
8759
|
+
_this.emit('user-unpublished', user, mediaType, streamId);
|
|
8760
|
+
});
|
|
8761
|
+
this._client.on('user-info-updated', function (uid, msg) {
|
|
8762
|
+
_this.emit('user-info-updated', uid, msg);
|
|
8763
|
+
});
|
|
8764
|
+
this._client.on('media-reconnect-start', function (uid) {
|
|
8765
|
+
_this.emit('media-reconnect-start', uid);
|
|
8766
|
+
});
|
|
8767
|
+
this._client.on('media-reconnect-end', function (uid) {
|
|
8768
|
+
_this.emit('media-reconnect-end', uid);
|
|
8769
|
+
});
|
|
8770
|
+
this._client.on('volume-indicator', function (result) {
|
|
8771
|
+
_this.emit('volume-indicator', result);
|
|
8772
|
+
});
|
|
8773
|
+
this._client.on('token-privilege-will-expire', function () {
|
|
8774
|
+
_this.emit('token-privilege-will-expire');
|
|
8775
|
+
});
|
|
8776
|
+
this._client.on('token-privilege-did-expire', function () {
|
|
8777
|
+
_this.emit('token-privilege-did-expire');
|
|
8778
|
+
});
|
|
8779
|
+
this._client.on('exception', function (result) {
|
|
8780
|
+
_this.emit('exception', result);
|
|
8706
8781
|
});
|
|
8707
8782
|
};
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
};
|
|
8720
|
-
AgoraRTC.prototype.createMicrophoneAndCameraTracks = function (audioConfig, videoConfig) {
|
|
8721
|
-
return Agora.createMicrophoneAndCameraTracks(audioConfig, videoConfig);
|
|
8722
|
-
};
|
|
8723
|
-
AgoraRTC.prototype.createMicrophoneAudioTrack = function (config) {
|
|
8724
|
-
return Agora.createMicrophoneAudioTrack(config);
|
|
8725
|
-
};
|
|
8726
|
-
AgoraRTC.prototype.createScreenVideoTrack = function (config, withAudio) {
|
|
8727
|
-
return Agora.createScreenVideoTrack(config, withAudio);
|
|
8728
|
-
};
|
|
8729
|
-
AgoraRTC.prototype.getSupportedCodec = function () {
|
|
8730
|
-
return Agora.getSupportedCodec();
|
|
8731
|
-
};
|
|
8732
|
-
AgoraRTC.prototype.checkSystemRequirements = function () {
|
|
8733
|
-
return Agora.checkSystemRequirements();
|
|
8734
|
-
};
|
|
8735
|
-
AgoraRTC.prototype.getDevices = function (skipPermissionCheck) {
|
|
8736
|
-
return Agora.getDevices(skipPermissionCheck);
|
|
8737
|
-
};
|
|
8738
|
-
AgoraRTC.prototype.getMicrophones = function (skipPermissionCheck) {
|
|
8739
|
-
return Agora.getMicrophones(skipPermissionCheck);
|
|
8740
|
-
};
|
|
8741
|
-
AgoraRTC.prototype.getCameras = function (skipPermissionCheck) {
|
|
8742
|
-
return Agora.getCameras(skipPermissionCheck);
|
|
8743
|
-
};
|
|
8744
|
-
AgoraRTC.prototype.getPlaybackDevices = function (skipPermissionCheck) {
|
|
8745
|
-
return Agora.getPlaybackDevices(skipPermissionCheck);
|
|
8746
|
-
};
|
|
8747
|
-
AgoraRTC.prototype.getElectronScreenSources = function (type) {
|
|
8748
|
-
return Agora.getElectronScreenSources(type);
|
|
8749
|
-
};
|
|
8750
|
-
AgoraRTC.prototype.setLogLevel = function (level) {
|
|
8751
|
-
return Agora.setLogLevel(level);
|
|
8752
|
-
};
|
|
8753
|
-
AgoraRTC.prototype.enableLogUpload = function () {
|
|
8754
|
-
return Agora.enableLogUpload();
|
|
8755
|
-
};
|
|
8756
|
-
AgoraRTC.prototype.disableLogUpload = function () {
|
|
8757
|
-
return Agora.disableLogUpload();
|
|
8758
|
-
};
|
|
8759
|
-
AgoraRTC.prototype.checkVideoTrackIsActive = function (track, timeout) {
|
|
8760
|
-
return Agora.checkVideoTrackIsActive(track, timeout);
|
|
8761
|
-
};
|
|
8762
|
-
AgoraRTC.prototype.checkAudioTrackIsActive = function (track, timeout) {
|
|
8763
|
-
return Agora.checkAudioTrackIsActive(track, timeout);
|
|
8764
|
-
};
|
|
8765
|
-
Object.defineProperty(AgoraRTC.prototype, "onCameraChanged", {
|
|
8766
|
-
get: function () {
|
|
8767
|
-
return Agora.onCameraChanged;
|
|
8768
|
-
},
|
|
8769
|
-
set: function (value) {
|
|
8770
|
-
Agora.onCameraChanged = value;
|
|
8771
|
-
},
|
|
8772
|
-
enumerable: false,
|
|
8773
|
-
configurable: true
|
|
8774
|
-
});
|
|
8775
|
-
Object.defineProperty(AgoraRTC.prototype, "onMicrophoneChanged", {
|
|
8776
|
-
get: function () {
|
|
8777
|
-
return Agora.onMicrophoneChanged;
|
|
8778
|
-
},
|
|
8779
|
-
set: function (value) {
|
|
8780
|
-
Agora.onMicrophoneChanged = value;
|
|
8781
|
-
},
|
|
8782
|
-
enumerable: false,
|
|
8783
|
-
configurable: true
|
|
8784
|
-
});
|
|
8785
|
-
Object.defineProperty(AgoraRTC.prototype, "onPlaybackDeviceChanged", {
|
|
8786
|
-
get: function () {
|
|
8787
|
-
return Agora.onPlaybackDeviceChanged;
|
|
8788
|
-
},
|
|
8789
|
-
set: function (value) {
|
|
8790
|
-
Agora.onPlaybackDeviceChanged = value;
|
|
8791
|
-
},
|
|
8792
|
-
enumerable: false,
|
|
8793
|
-
configurable: true
|
|
8794
|
-
});
|
|
8795
|
-
Object.defineProperty(AgoraRTC.prototype, "onAudioAutoplayFailed", {
|
|
8796
|
-
get: function () {
|
|
8797
|
-
return Agora.onAudioAutoplayFailed;
|
|
8798
|
-
},
|
|
8799
|
-
set: function (value) {
|
|
8800
|
-
Agora.onAudioAutoplayFailed = value;
|
|
8801
|
-
},
|
|
8802
|
-
enumerable: false,
|
|
8803
|
-
configurable: true
|
|
8804
|
-
});
|
|
8805
|
-
Object.defineProperty(AgoraRTC.prototype, "onAutoplayFailed", {
|
|
8806
|
-
get: function () {
|
|
8807
|
-
return Agora.onAutoplayFailed;
|
|
8808
|
-
},
|
|
8809
|
-
set: function (value) {
|
|
8810
|
-
Agora.onAutoplayFailed = value;
|
|
8811
|
-
},
|
|
8812
|
-
enumerable: false,
|
|
8813
|
-
configurable: true
|
|
8814
|
-
});
|
|
8815
|
-
AgoraRTC.prototype.setArea = function (area) {
|
|
8816
|
-
return Agora.setArea(area);
|
|
8817
|
-
};
|
|
8818
|
-
AgoraRTC.prototype.processExternalMediaAEC = function (element) {
|
|
8819
|
-
return Agora.processExternalMediaAEC(element);
|
|
8820
|
-
};
|
|
8821
|
-
return AgoraRTC;
|
|
8822
|
-
}());
|
|
8783
|
+
return Client;
|
|
8784
|
+
}(Emitter));
|
|
8785
|
+
var parseAgoraUserId = function (userId, flag) {
|
|
8786
|
+
return userId ^ codeMap[flag];
|
|
8787
|
+
};
|
|
8788
|
+
var streamFlagMap = ['main', 'sub', 'system'];
|
|
8789
|
+
var codeMap = {
|
|
8790
|
+
main: 0x0,
|
|
8791
|
+
sub: 0x40000000,
|
|
8792
|
+
system: 0x80000000,
|
|
8793
|
+
};
|
|
8823
8794
|
|
|
8824
8795
|
var CoreRTC$1 = /** @class */ (function () {
|
|
8825
8796
|
function CoreRTC(_a) {
|
|
@@ -8841,6 +8812,7 @@ var CoreRTC$1 = /** @class */ (function () {
|
|
|
8841
8812
|
token: this._token,
|
|
8842
8813
|
plan: this._plan,
|
|
8843
8814
|
type: RTCEngineType.Core,
|
|
8815
|
+
prefix: config.streamPrefix,
|
|
8844
8816
|
});
|
|
8845
8817
|
};
|
|
8846
8818
|
CoreRTC.prototype.createBufferSourceAudioTrack = function (config) {
|
|
@@ -9109,7 +9081,7 @@ function log(clsName) {
|
|
|
9109
9081
|
sdk_api_name: '中间层-函数调用',
|
|
9110
9082
|
message: "\u4E2D\u95F4\u5C42-" + clsName + "." + name,
|
|
9111
9083
|
from_encapsulation_layer: true,
|
|
9112
|
-
encapsulation_layer_built_timestamp: '2025/8/
|
|
9084
|
+
encapsulation_layer_built_timestamp: '2025/8/13 14:48:43',
|
|
9113
9085
|
});
|
|
9114
9086
|
}
|
|
9115
9087
|
}
|
|
@@ -10879,7 +10851,7 @@ var VolcVideoPlayer = /** @class */ (function (_super) {
|
|
|
10879
10851
|
};
|
|
10880
10852
|
// 播放视频
|
|
10881
10853
|
VolcVideoPlayer.prototype.playVideo = function (mediaStreamTrack) {
|
|
10882
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
10854
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
10883
10855
|
var vDom, ms;
|
|
10884
10856
|
var _this = this;
|
|
10885
10857
|
return __generator(this, function (_a) {
|
|
@@ -11265,7 +11237,7 @@ var AudioLevelFetcher = /** @class */ (function () {
|
|
|
11265
11237
|
};
|
|
11266
11238
|
AudioLevelFetcher.prototype.resume = function () {
|
|
11267
11239
|
var _a;
|
|
11268
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
11240
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
11269
11241
|
return __generator(this, function (_b) {
|
|
11270
11242
|
switch (_b.label) {
|
|
11271
11243
|
case 0: return [4 /*yield*/, ((_a = this._ctx) === null || _a === void 0 ? void 0 : _a.resume().catch(function (e) {
|
|
@@ -11489,7 +11461,7 @@ var VolcAudioPlayer = /** @class */ (function (_super) {
|
|
|
11489
11461
|
// 插入promise
|
|
11490
11462
|
ret = ret.then(function () {
|
|
11491
11463
|
return new Promise(function (resolve) {
|
|
11492
|
-
setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
11464
|
+
setTimeout(function () { return __awaiter$2(_this, void 0, void 0, function () {
|
|
11493
11465
|
var _a;
|
|
11494
11466
|
return __generator(this, function (_b) {
|
|
11495
11467
|
switch (_b.label) {
|
|
@@ -11606,7 +11578,7 @@ var VolcAudioPlayer = /** @class */ (function (_super) {
|
|
|
11606
11578
|
// rawRTCMediaStreamTrack RTC 收到的 原始 mediaStreamTrack
|
|
11607
11579
|
// mediaStreamTrack 经过 Web Audio 放大的 mediaStreamTrack
|
|
11608
11580
|
VolcAudioPlayer.prototype.playAudio = function (mediaStreamTrack, rawRTCMediaStreamTrack) {
|
|
11609
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
11581
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
11610
11582
|
var aDom, ms;
|
|
11611
11583
|
var _this = this;
|
|
11612
11584
|
return __generator(this, function (_a) {
|
|
@@ -11733,12 +11705,15 @@ var VolcAudioPlayer = /** @class */ (function (_super) {
|
|
|
11733
11705
|
});
|
|
11734
11706
|
};
|
|
11735
11707
|
VolcAudioPlayer.prototype.setPlaybackDevice = function (deviceId) {
|
|
11736
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
11708
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
11737
11709
|
var devices, audioDeviceIds;
|
|
11738
11710
|
return __generator(this, function (_a) {
|
|
11739
11711
|
switch (_a.label) {
|
|
11740
11712
|
case 0:
|
|
11741
11713
|
printLocal('setPlaybackDevice', "setPlaybackDevice: " + deviceId);
|
|
11714
|
+
if (!deviceId) {
|
|
11715
|
+
return [2 /*return*/];
|
|
11716
|
+
}
|
|
11742
11717
|
return [4 /*yield*/, VERTC.enumerateAudioPlaybackDevices()];
|
|
11743
11718
|
case 1:
|
|
11744
11719
|
devices = _a.sent();
|
|
@@ -12085,7 +12060,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12085
12060
|
this._stopPublishingWhenTrackEnded();
|
|
12086
12061
|
};
|
|
12087
12062
|
VolcLocalTrack.prototype._trackMuteHandler = function () {
|
|
12088
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12063
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12089
12064
|
return __generator(this, function (_a) {
|
|
12090
12065
|
switch (_a.label) {
|
|
12091
12066
|
case 0:
|
|
@@ -12155,7 +12130,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12155
12130
|
};
|
|
12156
12131
|
VolcLocalTrack.prototype._startCapturing = function () {
|
|
12157
12132
|
var _a, _b, _c, _d;
|
|
12158
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12133
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12159
12134
|
return __generator(this, function (_e) {
|
|
12160
12135
|
switch (_e.label) {
|
|
12161
12136
|
case 0:
|
|
@@ -12191,7 +12166,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12191
12166
|
};
|
|
12192
12167
|
VolcLocalTrack.prototype._stopCapturing = function () {
|
|
12193
12168
|
var _a, _b, _c, _d;
|
|
12194
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12169
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12195
12170
|
return __generator(this, function (_e) {
|
|
12196
12171
|
switch (_e.label) {
|
|
12197
12172
|
case 0:
|
|
@@ -12219,7 +12194,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12219
12194
|
};
|
|
12220
12195
|
VolcLocalTrack.prototype._startScreenCapturing = function () {
|
|
12221
12196
|
var _a, _b, _c, _d;
|
|
12222
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12197
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12223
12198
|
return __generator(this, function (_e) {
|
|
12224
12199
|
switch (_e.label) {
|
|
12225
12200
|
case 0:
|
|
@@ -12259,7 +12234,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12259
12234
|
};
|
|
12260
12235
|
VolcLocalTrack.prototype._stopScreenCapturing = function () {
|
|
12261
12236
|
var _a, _b;
|
|
12262
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12237
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12263
12238
|
return __generator(this, function (_c) {
|
|
12264
12239
|
switch (_c.label) {
|
|
12265
12240
|
case 0:
|
|
@@ -12276,7 +12251,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12276
12251
|
};
|
|
12277
12252
|
VolcLocalTrack.prototype.setEnabled = function (enabled) {
|
|
12278
12253
|
var _a;
|
|
12279
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12254
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12280
12255
|
var msg;
|
|
12281
12256
|
return __generator(this, function (_b) {
|
|
12282
12257
|
switch (_b.label) {
|
|
@@ -12295,7 +12270,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12295
12270
|
});
|
|
12296
12271
|
};
|
|
12297
12272
|
VolcLocalTrack.prototype._checkStatus = function () {
|
|
12298
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12273
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12299
12274
|
return __generator(this, function (_a) {
|
|
12300
12275
|
if (this.isScreen) {
|
|
12301
12276
|
return [2 /*return*/, this._checkStatusForScreen()];
|
|
@@ -12308,7 +12283,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12308
12283
|
};
|
|
12309
12284
|
VolcLocalTrack.prototype._checkStatusForMain = function () {
|
|
12310
12285
|
var _a, _b;
|
|
12311
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12286
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12312
12287
|
var mediaType;
|
|
12313
12288
|
return __generator(this, function (_c) {
|
|
12314
12289
|
switch (_c.label) {
|
|
@@ -12347,7 +12322,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12347
12322
|
};
|
|
12348
12323
|
VolcLocalTrack.prototype._stopPublishingWhenTrackEnded = function () {
|
|
12349
12324
|
var _a, _b;
|
|
12350
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12325
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12351
12326
|
var mediaType;
|
|
12352
12327
|
return __generator(this, function (_c) {
|
|
12353
12328
|
switch (_c.label) {
|
|
@@ -12383,7 +12358,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12383
12358
|
VolcLocalTrack.prototype._refreshPlayAfterTrackUpdated = function () { };
|
|
12384
12359
|
VolcLocalTrack.prototype._checkStatusForScreen = function () {
|
|
12385
12360
|
var _a, _b;
|
|
12386
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12361
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12387
12362
|
var mediaType;
|
|
12388
12363
|
return __generator(this, function (_c) {
|
|
12389
12364
|
switch (_c.label) {
|
|
@@ -12422,7 +12397,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12422
12397
|
};
|
|
12423
12398
|
VolcLocalTrack.prototype.setMuted = function (muted) {
|
|
12424
12399
|
var _a;
|
|
12425
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12400
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12426
12401
|
var msg;
|
|
12427
12402
|
return __generator(this, function (_b) {
|
|
12428
12403
|
switch (_b.label) {
|
|
@@ -12471,7 +12446,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12471
12446
|
// getStats(): LocalVideoTrackStats | LocalAudioTrackStats {}
|
|
12472
12447
|
VolcLocalTrack.prototype.close = function () {
|
|
12473
12448
|
var _a, _b, _c, _d, _e, _f;
|
|
12474
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12449
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12475
12450
|
var _g, _h, _j;
|
|
12476
12451
|
return __generator(this, function (_k) {
|
|
12477
12452
|
switch (_k.label) {
|
|
@@ -12871,7 +12846,7 @@ var VolcCameraVideoTrack = /** @class */ (function (_super) {
|
|
|
12871
12846
|
}
|
|
12872
12847
|
VolcCameraVideoTrack.prototype.setDevice = function (deviceId) {
|
|
12873
12848
|
var _a, _b, _c, _d;
|
|
12874
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12849
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12875
12850
|
var needResumePlay;
|
|
12876
12851
|
return __generator(this, function (_e) {
|
|
12877
12852
|
switch (_e.label) {
|
|
@@ -12911,7 +12886,7 @@ var VolcCameraVideoTrack = /** @class */ (function (_super) {
|
|
|
12911
12886
|
});
|
|
12912
12887
|
};
|
|
12913
12888
|
VolcCameraVideoTrack.prototype.setEncoderConfiguration = function (config) {
|
|
12914
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12889
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12915
12890
|
var videoEncoderConfig;
|
|
12916
12891
|
return __generator(this, function (_a) {
|
|
12917
12892
|
switch (_a.label) {
|
|
@@ -13043,6 +13018,7 @@ var VolcLocalAudioTrack = /** @class */ (function (_super) {
|
|
|
13043
13018
|
};
|
|
13044
13019
|
// 获取本地音频轨道的音量等级。返回音量等级值,范围 [0, 1],1 代表理论最大音量。
|
|
13045
13020
|
// https://rtcdocs.magic-school.com/api/web/classes/track_LocalAudioTrack.LocalAudioTrack.html#getvolumelevel
|
|
13021
|
+
// @log('VolcLocalAudioTrack')
|
|
13046
13022
|
VolcLocalAudioTrack.prototype.getVolumeLevel = function () {
|
|
13047
13023
|
// htmlMediaElement 元素音量等级
|
|
13048
13024
|
// return this._domElement ? this._domElement.volume : 0;
|
|
@@ -13084,7 +13060,7 @@ var VolcLocalAudioTrack = /** @class */ (function (_super) {
|
|
|
13084
13060
|
}
|
|
13085
13061
|
};
|
|
13086
13062
|
VolcLocalAudioTrack.prototype.setPlaybackDevice = function (deviceId) {
|
|
13087
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
13063
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
13088
13064
|
var monitor;
|
|
13089
13065
|
return __generator(this, function (_a) {
|
|
13090
13066
|
switch (_a.label) {
|
|
@@ -13130,9 +13106,6 @@ var VolcLocalAudioTrack = /** @class */ (function (_super) {
|
|
|
13130
13106
|
__decorate([
|
|
13131
13107
|
log('VolcLocalAudioTrack')
|
|
13132
13108
|
], VolcLocalAudioTrack.prototype, "setVolume", null);
|
|
13133
|
-
__decorate([
|
|
13134
|
-
log('VolcLocalAudioTrack')
|
|
13135
|
-
], VolcLocalAudioTrack.prototype, "getVolumeLevel", null);
|
|
13136
13109
|
__decorate([
|
|
13137
13110
|
log('VolcLocalAudioTrack')
|
|
13138
13111
|
], VolcLocalAudioTrack.prototype, "play", null);
|
|
@@ -13164,7 +13137,7 @@ var VolcMicrophoneAudioTrack = /** @class */ (function (_super) {
|
|
|
13164
13137
|
return _this;
|
|
13165
13138
|
}
|
|
13166
13139
|
VolcMicrophoneAudioTrack.prototype.setDevice = function (deviceId) {
|
|
13167
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
13140
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
13168
13141
|
return __generator(this, function (_a) {
|
|
13169
13142
|
switch (_a.label) {
|
|
13170
13143
|
case 0:
|
|
@@ -13306,6 +13279,7 @@ var VolcRemoteAudioTrack = /** @class */ (function (_super) {
|
|
|
13306
13279
|
};
|
|
13307
13280
|
// 获取远端音频轨道的音量等级。返回音量等级值,范围 [0, 1],1 代表理论最大音量。
|
|
13308
13281
|
// https://rtcdocs.magic-school.com/api/web/classes/track_RemoteAudioTrack.RemoteAudioTrack.html#getvolumelevel
|
|
13282
|
+
// @log('VolcRemoteAudioTrack')
|
|
13309
13283
|
VolcRemoteAudioTrack.prototype.getVolumeLevel = function () {
|
|
13310
13284
|
// htmlMediaElement 元素音量等级
|
|
13311
13285
|
// return this._domElement ? this._domElement.volume : 0;
|
|
@@ -13330,7 +13304,7 @@ var VolcRemoteAudioTrack = /** @class */ (function (_super) {
|
|
|
13330
13304
|
this._volumeLevel = val;
|
|
13331
13305
|
};
|
|
13332
13306
|
VolcRemoteAudioTrack.prototype.setPlaybackDevice = function (deviceId) {
|
|
13333
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
13307
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
13334
13308
|
var monitor;
|
|
13335
13309
|
return __generator(this, function (_a) {
|
|
13336
13310
|
switch (_a.label) {
|
|
@@ -13421,9 +13395,6 @@ var VolcRemoteAudioTrack = /** @class */ (function (_super) {
|
|
|
13421
13395
|
__decorate([
|
|
13422
13396
|
log('VolcRemoteAudioTrack')
|
|
13423
13397
|
], VolcRemoteAudioTrack.prototype, "_playerEventHandler", null);
|
|
13424
|
-
__decorate([
|
|
13425
|
-
log('VolcRemoteAudioTrack')
|
|
13426
|
-
], VolcRemoteAudioTrack.prototype, "getVolumeLevel", null);
|
|
13427
13398
|
__decorate([
|
|
13428
13399
|
log('VolcRemoteAudioTrack')
|
|
13429
13400
|
], VolcRemoteAudioTrack.prototype, "setVolumeLevel", null);
|
|
@@ -13688,7 +13659,7 @@ var RTCRemoteUser = /** @class */ (function () {
|
|
|
13688
13659
|
return RTCRemoteUser;
|
|
13689
13660
|
}());
|
|
13690
13661
|
|
|
13691
|
-
var handleVideoTrackInitConfig = function (engine, config, forPublish, cameraVideoTrack) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13662
|
+
var handleVideoTrackInitConfig = function (engine, config, forPublish, cameraVideoTrack) { return __awaiter$2(void 0, void 0, void 0, function () {
|
|
13692
13663
|
var videoEncoderConfig;
|
|
13693
13664
|
return __generator(this, function (_a) {
|
|
13694
13665
|
switch (_a.label) {
|
|
@@ -13734,7 +13705,7 @@ var handleVideoTrackInitConfig = function (engine, config, forPublish, cameraVid
|
|
|
13734
13705
|
}
|
|
13735
13706
|
});
|
|
13736
13707
|
}); };
|
|
13737
|
-
var handleAudioTrackInitConfig = function (engine, config, forPublish) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13708
|
+
var handleAudioTrackInitConfig = function (engine, config, forPublish) { return __awaiter$2(void 0, void 0, void 0, function () {
|
|
13738
13709
|
var mediaTrackConstraints, audioEncodeConfig;
|
|
13739
13710
|
return __generator(this, function (_a) {
|
|
13740
13711
|
switch (_a.label) {
|
|
@@ -13786,7 +13757,7 @@ var handleAudioTrackInitConfig = function (engine, config, forPublish) { return
|
|
|
13786
13757
|
}
|
|
13787
13758
|
});
|
|
13788
13759
|
}); };
|
|
13789
|
-
var handleScreenVideoTrackInitConfig = function (engine, config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13760
|
+
var handleScreenVideoTrackInitConfig = function (engine, config) { return __awaiter$2(void 0, void 0, void 0, function () {
|
|
13790
13761
|
var screenVideoEncoderConfig;
|
|
13791
13762
|
return __generator(this, function (_a) {
|
|
13792
13763
|
switch (_a.label) {
|
|
@@ -13805,7 +13776,7 @@ var handleScreenVideoTrackInitConfig = function (engine, config) { return __awai
|
|
|
13805
13776
|
}
|
|
13806
13777
|
});
|
|
13807
13778
|
}); };
|
|
13808
|
-
var handleExternalVideoTrackInitConfig = function (engine, config, applyForPublish) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13779
|
+
var handleExternalVideoTrackInitConfig = function (engine, config, applyForPublish) { return __awaiter$2(void 0, void 0, void 0, function () {
|
|
13809
13780
|
var mediaStreamTrack, currSettings, externalVideoEncoderConfig;
|
|
13810
13781
|
return __generator(this, function (_a) {
|
|
13811
13782
|
switch (_a.label) {
|
|
@@ -13838,7 +13809,7 @@ var handleExternalVideoTrackInitConfig = function (engine, config, applyForPubli
|
|
|
13838
13809
|
}
|
|
13839
13810
|
});
|
|
13840
13811
|
}); };
|
|
13841
|
-
var handleExternalScreenVideoTrackInitConfig = function (engine, config, applyForPublish) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13812
|
+
var handleExternalScreenVideoTrackInitConfig = function (engine, config, applyForPublish) { return __awaiter$2(void 0, void 0, void 0, function () {
|
|
13842
13813
|
var mediaStreamTrack, currSettings, externalVideoEncoderConfig;
|
|
13843
13814
|
return __generator(this, function (_a) {
|
|
13844
13815
|
switch (_a.label) {
|
|
@@ -13870,7 +13841,7 @@ var handleExternalScreenVideoTrackInitConfig = function (engine, config, applyFo
|
|
|
13870
13841
|
}
|
|
13871
13842
|
});
|
|
13872
13843
|
}); };
|
|
13873
|
-
var handleExternalAudioTrackInitConfig = function (engine, config, applyForPublish) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13844
|
+
var handleExternalAudioTrackInitConfig = function (engine, config, applyForPublish) { return __awaiter$2(void 0, void 0, void 0, function () {
|
|
13874
13845
|
var audioEncodeConfig, mediaTrackConstraints;
|
|
13875
13846
|
return __generator(this, function (_a) {
|
|
13876
13847
|
switch (_a.label) {
|
|
@@ -13897,7 +13868,7 @@ var handleExternalAudioTrackInitConfig = function (engine, config, applyForPubli
|
|
|
13897
13868
|
});
|
|
13898
13869
|
}); };
|
|
13899
13870
|
// screen-audio 和 audio external track 编码控制没有区别
|
|
13900
|
-
var handleExternalScreenAudioTrackInitConfig = function (engine, config, applyForPublish) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13871
|
+
var handleExternalScreenAudioTrackInitConfig = function (engine, config, applyForPublish) { return __awaiter$2(void 0, void 0, void 0, function () {
|
|
13901
13872
|
var audioEncodeConfig, mediaTrackConstraints;
|
|
13902
13873
|
return __generator(this, function (_a) {
|
|
13903
13874
|
switch (_a.label) {
|
|
@@ -14206,11 +14177,11 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14206
14177
|
var remoteUser = this._remoteUserMap[userId];
|
|
14207
14178
|
if (hasPublishVideo) {
|
|
14208
14179
|
remoteUser.hasVideo = true;
|
|
14209
|
-
this.emit('user-published', remoteUser, 'video');
|
|
14180
|
+
this.emit('user-published', remoteUser, 'video', 'main');
|
|
14210
14181
|
}
|
|
14211
14182
|
if (hasPublishAudio) {
|
|
14212
14183
|
remoteUser.hasAudio = true;
|
|
14213
|
-
this.emit('user-published', remoteUser, 'audio');
|
|
14184
|
+
this.emit('user-published', remoteUser, 'audio', 'main');
|
|
14214
14185
|
}
|
|
14215
14186
|
};
|
|
14216
14187
|
VolcClient.prototype._onUserPublishScreenHandler = function (e) {
|
|
@@ -14223,7 +14194,11 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14223
14194
|
var remoteUser = this._remoteUserMap[userId];
|
|
14224
14195
|
if (hasPublishVideo) {
|
|
14225
14196
|
remoteUser.hasScreen = true;
|
|
14226
|
-
this.emit('user-published', remoteUser, '
|
|
14197
|
+
this.emit('user-published', remoteUser, 'video', 'sub');
|
|
14198
|
+
}
|
|
14199
|
+
if (hasPublishAudio) {
|
|
14200
|
+
// 本期暂不支持屏幕共享音频, 所以不做处理
|
|
14201
|
+
this.emit('user-published', remoteUser, 'audio', 'sub');
|
|
14227
14202
|
}
|
|
14228
14203
|
};
|
|
14229
14204
|
VolcClient.prototype._onUserUnpublishStreamHandler = function (e) {
|
|
@@ -14236,11 +14211,11 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14236
14211
|
var remoteUser = this._remoteUserMap[userId];
|
|
14237
14212
|
if (hasUnpublishAudio) {
|
|
14238
14213
|
remoteUser.hasAudio = false;
|
|
14239
|
-
this.emit('user-unpublished', remoteUser, 'audio');
|
|
14214
|
+
this.emit('user-unpublished', remoteUser, 'audio', 'main');
|
|
14240
14215
|
}
|
|
14241
14216
|
if (hasUnpublishVideo) {
|
|
14242
14217
|
remoteUser.hasVideo = false;
|
|
14243
|
-
this.emit('user-unpublished', remoteUser, 'video');
|
|
14218
|
+
this.emit('user-unpublished', remoteUser, 'video', 'main');
|
|
14244
14219
|
}
|
|
14245
14220
|
};
|
|
14246
14221
|
VolcClient.prototype._onUserUnpublishScreenHandler = function (e) {
|
|
@@ -14253,7 +14228,11 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14253
14228
|
var remoteUser = this._remoteUserMap[userId];
|
|
14254
14229
|
if (hasUnpublishVideo) {
|
|
14255
14230
|
remoteUser.hasScreen = false;
|
|
14256
|
-
this.emit('user-unpublished', remoteUser, '
|
|
14231
|
+
this.emit('user-unpublished', remoteUser, 'video', 'sub');
|
|
14232
|
+
}
|
|
14233
|
+
if (hasUnpublishAudio) {
|
|
14234
|
+
// 本期暂不支持屏幕共享音频, 所以不做处理
|
|
14235
|
+
this.emit('user-unpublished', remoteUser, 'audio', 'sub');
|
|
14257
14236
|
}
|
|
14258
14237
|
};
|
|
14259
14238
|
VolcClient.prototype._onError = function (e) {
|
|
@@ -14306,7 +14285,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14306
14285
|
// on(event: string, listener: Function): void;
|
|
14307
14286
|
// P0
|
|
14308
14287
|
VolcClient.prototype.join = function () {
|
|
14309
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14288
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14310
14289
|
var _this_1 = this;
|
|
14311
14290
|
return __generator(this, function (_a) {
|
|
14312
14291
|
recoverVolcUsedAPIs();
|
|
@@ -14359,7 +14338,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14359
14338
|
};
|
|
14360
14339
|
// P0
|
|
14361
14340
|
VolcClient.prototype.leave = function () {
|
|
14362
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14341
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14363
14342
|
var _this_1 = this;
|
|
14364
14343
|
return __generator(this, function (_a) {
|
|
14365
14344
|
volcCommonStatus.hasJoinRoom = false;
|
|
@@ -14382,7 +14361,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14382
14361
|
});
|
|
14383
14362
|
};
|
|
14384
14363
|
VolcClient.prototype._prepareForPublishCameraVideo = function (cameraVideoTrack) {
|
|
14385
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14364
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14386
14365
|
return __generator(this, function (_a) {
|
|
14387
14366
|
switch (_a.label) {
|
|
14388
14367
|
case 0:
|
|
@@ -14398,7 +14377,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14398
14377
|
});
|
|
14399
14378
|
};
|
|
14400
14379
|
VolcClient.prototype._prepareForPublishMicrophoneAudio = function (microphoneAudioTrack) {
|
|
14401
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14380
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14402
14381
|
return __generator(this, function (_a) {
|
|
14403
14382
|
switch (_a.label) {
|
|
14404
14383
|
case 0:
|
|
@@ -14417,7 +14396,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14417
14396
|
});
|
|
14418
14397
|
};
|
|
14419
14398
|
VolcClient.prototype._prepareForPublishScreenVideo = function (screenVideoTrack) {
|
|
14420
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14399
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14421
14400
|
return __generator(this, function (_a) {
|
|
14422
14401
|
switch (_a.label) {
|
|
14423
14402
|
case 0:
|
|
@@ -14437,7 +14416,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14437
14416
|
});
|
|
14438
14417
|
};
|
|
14439
14418
|
VolcClient.prototype._prepareForPublishScreenAudio = function (screenAudioTrack) {
|
|
14440
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14419
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14441
14420
|
return __generator(this, function (_a) {
|
|
14442
14421
|
switch (_a.label) {
|
|
14443
14422
|
case 0:
|
|
@@ -14452,7 +14431,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14452
14431
|
});
|
|
14453
14432
|
};
|
|
14454
14433
|
VolcClient.prototype._prepareForPublishExternalVideo = function (externalVideo) {
|
|
14455
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14434
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14456
14435
|
return __generator(this, function (_a) {
|
|
14457
14436
|
switch (_a.label) {
|
|
14458
14437
|
case 0:
|
|
@@ -14474,7 +14453,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14474
14453
|
});
|
|
14475
14454
|
};
|
|
14476
14455
|
VolcClient.prototype._prepareForPublishExternalAudio = function (externalAudio) {
|
|
14477
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14456
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14478
14457
|
return __generator(this, function (_a) {
|
|
14479
14458
|
switch (_a.label) {
|
|
14480
14459
|
case 0:
|
|
@@ -14496,7 +14475,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14496
14475
|
});
|
|
14497
14476
|
};
|
|
14498
14477
|
VolcClient.prototype._prepareForPublishExternalScreenVideo = function (externalScreenVideo) {
|
|
14499
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14478
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14500
14479
|
return __generator(this, function (_a) {
|
|
14501
14480
|
switch (_a.label) {
|
|
14502
14481
|
case 0:
|
|
@@ -14519,7 +14498,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14519
14498
|
});
|
|
14520
14499
|
};
|
|
14521
14500
|
VolcClient.prototype._prepareForPublishExternalScreenAudio = function (externalScreenAudio) {
|
|
14522
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14501
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14523
14502
|
return __generator(this, function (_a) {
|
|
14524
14503
|
switch (_a.label) {
|
|
14525
14504
|
case 0:
|
|
@@ -14542,7 +14521,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14542
14521
|
});
|
|
14543
14522
|
};
|
|
14544
14523
|
VolcClient.prototype._prepareForUnPublishCameraVideo = function () {
|
|
14545
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14524
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14546
14525
|
return __generator(this, function (_a) {
|
|
14547
14526
|
switch (_a.label) {
|
|
14548
14527
|
case 0:
|
|
@@ -14556,7 +14535,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14556
14535
|
});
|
|
14557
14536
|
};
|
|
14558
14537
|
VolcClient.prototype._prepareForUnPublishMicrophoneAudio = function () {
|
|
14559
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14538
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14560
14539
|
return __generator(this, function (_a) {
|
|
14561
14540
|
switch (_a.label) {
|
|
14562
14541
|
case 0:
|
|
@@ -14570,7 +14549,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14570
14549
|
});
|
|
14571
14550
|
};
|
|
14572
14551
|
VolcClient.prototype._prepareForUnPublishScreenVideo = function () {
|
|
14573
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14552
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14574
14553
|
return __generator(this, function (_a) {
|
|
14575
14554
|
switch (_a.label) {
|
|
14576
14555
|
case 0:
|
|
@@ -14585,7 +14564,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14585
14564
|
});
|
|
14586
14565
|
};
|
|
14587
14566
|
VolcClient.prototype._prepareForUnPublishScreenAudio = function () {
|
|
14588
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14567
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14589
14568
|
return __generator(this, function (_a) {
|
|
14590
14569
|
switch (_a.label) {
|
|
14591
14570
|
case 0:
|
|
@@ -14600,7 +14579,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14600
14579
|
});
|
|
14601
14580
|
};
|
|
14602
14581
|
VolcClient.prototype._prepareForUnPublishExternalVideo = function () {
|
|
14603
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14582
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14604
14583
|
return __generator(this, function (_a) {
|
|
14605
14584
|
switch (_a.label) {
|
|
14606
14585
|
case 0:
|
|
@@ -14614,7 +14593,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14614
14593
|
});
|
|
14615
14594
|
};
|
|
14616
14595
|
VolcClient.prototype._prepareForUnPublishExternalAudio = function () {
|
|
14617
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14596
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14618
14597
|
return __generator(this, function (_a) {
|
|
14619
14598
|
switch (_a.label) {
|
|
14620
14599
|
case 0:
|
|
@@ -14628,7 +14607,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14628
14607
|
});
|
|
14629
14608
|
};
|
|
14630
14609
|
VolcClient.prototype._prepareForUnPublishExternalScreenVideo = function () {
|
|
14631
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14610
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14632
14611
|
return __generator(this, function (_a) {
|
|
14633
14612
|
switch (_a.label) {
|
|
14634
14613
|
case 0:
|
|
@@ -14643,7 +14622,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14643
14622
|
});
|
|
14644
14623
|
};
|
|
14645
14624
|
VolcClient.prototype._prepareForUnPublishExternalScreenAudio = function () {
|
|
14646
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14625
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14647
14626
|
return __generator(this, function (_a) {
|
|
14648
14627
|
switch (_a.label) {
|
|
14649
14628
|
case 0:
|
|
@@ -14659,7 +14638,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14659
14638
|
};
|
|
14660
14639
|
// P0
|
|
14661
14640
|
VolcClient.prototype.publish = function (tracks) {
|
|
14662
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14641
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14663
14642
|
var trackList, includeVideo, includeAudio, includeScreenVideo, includeScreenAudio, includeVideoExternal, includeAudioExternal, includeScreenVideoExternal, includeScreenAudioExternal, shouldPublishVideo, shouldPublishAudio, shouldPublishScreenVideo, shouldPublishScreenAudio, shouldPublishExternalVideo, shouldPublishExternalAudio, shouldPublishExternalScreenVideo, shouldPublishExternalScreenAudio, mediaType, mediaTypeForScreen, mediaTypeExternal, mediaTypeForScreenExternal;
|
|
14664
14643
|
return __generator(this, function (_a) {
|
|
14665
14644
|
switch (_a.label) {
|
|
@@ -14869,7 +14848,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14869
14848
|
* @returns
|
|
14870
14849
|
*/
|
|
14871
14850
|
VolcClient.prototype.unpublish = function (tracks) {
|
|
14872
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14851
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14873
14852
|
var prevPublishedTrack, trackList, includeVideo, includeAudio, includeScreenVideo, includeScreenAudio, includeVideoExternal, includeAudioExternal, includeScreenVideoExternal, includeScreenAudioExternal, mediaType, mediaTypeForScreen, mediaTypeExternal, mediaTypeForScreenExternal;
|
|
14874
14853
|
var _this_1 = this;
|
|
14875
14854
|
return __generator(this, function (_a) {
|
|
@@ -15032,8 +15011,8 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15032
15011
|
});
|
|
15033
15012
|
});
|
|
15034
15013
|
};
|
|
15035
|
-
VolcClient.prototype.subscribe = function (user, mediaType) {
|
|
15036
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15014
|
+
VolcClient.prototype.subscribe = function (user, mediaType, flag) {
|
|
15015
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15037
15016
|
var mType, track;
|
|
15038
15017
|
return __generator(this, function (_a) {
|
|
15039
15018
|
switch (_a.label) {
|
|
@@ -15041,21 +15020,20 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15041
15020
|
mType = {
|
|
15042
15021
|
video: MediaType.VIDEO,
|
|
15043
15022
|
audio: MediaType.AUDIO,
|
|
15044
|
-
screen: MediaType.VIDEO,
|
|
15045
15023
|
}[mediaType];
|
|
15046
|
-
if (!(
|
|
15024
|
+
if (!(flag === 'main')) return [3 /*break*/, 2];
|
|
15047
15025
|
return [4 /*yield*/, this._engine.subscribeStream(String(user.uid), mType)];
|
|
15048
15026
|
case 1:
|
|
15049
15027
|
_a.sent();
|
|
15050
15028
|
return [3 /*break*/, 4];
|
|
15051
15029
|
case 2:
|
|
15052
|
-
if (!(
|
|
15030
|
+
if (!(flag === 'sub')) return [3 /*break*/, 4];
|
|
15053
15031
|
return [4 /*yield*/, this._engine.subscribeScreen(String(user.uid), mType)];
|
|
15054
15032
|
case 3:
|
|
15055
15033
|
_a.sent();
|
|
15056
15034
|
_a.label = 4;
|
|
15057
15035
|
case 4:
|
|
15058
|
-
if (mediaType === 'video') {
|
|
15036
|
+
if (mediaType === 'video' && flag === 'main') {
|
|
15059
15037
|
track = new VolcRemoteVideoTrack();
|
|
15060
15038
|
track.engine = this._engine;
|
|
15061
15039
|
track.track = this._engine.getRemoteStreamTrack(String(user.uid), StreamIndex.STREAM_INDEX_MAIN, 'video');
|
|
@@ -15063,7 +15041,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15063
15041
|
user.videoTrack = track;
|
|
15064
15042
|
this._stats.remoteVideo.startSubscribe(user);
|
|
15065
15043
|
}
|
|
15066
|
-
|
|
15044
|
+
if (mediaType === 'audio' && flag === 'main') {
|
|
15067
15045
|
track = new VolcRemoteAudioTrack();
|
|
15068
15046
|
track.engine = this._engine;
|
|
15069
15047
|
track.track = this._engine.getRemoteStreamTrack(String(user.uid), StreamIndex.STREAM_INDEX_MAIN, 'audio');
|
|
@@ -15071,7 +15049,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15071
15049
|
user.audioTrack = track;
|
|
15072
15050
|
this._stats.remoteAudio.startSubscribe(user);
|
|
15073
15051
|
}
|
|
15074
|
-
|
|
15052
|
+
if (mediaType === 'video' && flag === 'sub') {
|
|
15075
15053
|
track = new VolcRemoteVideoTrack();
|
|
15076
15054
|
track.engine = this._engine;
|
|
15077
15055
|
track.track = this._engine.getRemoteStreamTrack(String(user.uid), StreamIndex.STREAM_INDEX_SCREEN, 'video');
|
|
@@ -15079,6 +15057,14 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15079
15057
|
track.isScreen = true;
|
|
15080
15058
|
user.screenTrack = track;
|
|
15081
15059
|
}
|
|
15060
|
+
if (mediaType === 'audio' && flag === 'sub') {
|
|
15061
|
+
track = new VolcRemoteAudioTrack();
|
|
15062
|
+
track.engine = this._engine;
|
|
15063
|
+
track.track = this._engine.getRemoteStreamTrack(String(user.uid), StreamIndex.STREAM_INDEX_SCREEN, 'audio');
|
|
15064
|
+
track.setUserId(user.uid);
|
|
15065
|
+
track.isScreen = true;
|
|
15066
|
+
user.screenAudioTrack = track;
|
|
15067
|
+
}
|
|
15082
15068
|
return [2 /*return*/, track];
|
|
15083
15069
|
}
|
|
15084
15070
|
});
|
|
@@ -15095,13 +15081,13 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15095
15081
|
// error?: OmniRTCError;
|
|
15096
15082
|
// }[]>;
|
|
15097
15083
|
// P0
|
|
15098
|
-
VolcClient.prototype.unsubscribe = function (user, mediaType) {
|
|
15099
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15084
|
+
VolcClient.prototype.unsubscribe = function (user, mediaType, flag) {
|
|
15085
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15100
15086
|
var mType;
|
|
15101
15087
|
return __generator(this, function (_a) {
|
|
15102
15088
|
switch (_a.label) {
|
|
15103
15089
|
case 0:
|
|
15104
|
-
if (mediaType === 'video') {
|
|
15090
|
+
if (mediaType === 'video' && flag === 'main') {
|
|
15105
15091
|
mType = MediaType.VIDEO;
|
|
15106
15092
|
if (user.videoTrack) {
|
|
15107
15093
|
user.videoTrack.track = undefined;
|
|
@@ -15110,7 +15096,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15110
15096
|
this._stats.remoteVideo.stopSubscribe(user);
|
|
15111
15097
|
return [2 /*return*/, this._engine.unsubscribeStream(String(user.uid), mType)];
|
|
15112
15098
|
}
|
|
15113
|
-
if (mediaType === 'audio') {
|
|
15099
|
+
if (mediaType === 'audio' && flag === 'main') {
|
|
15114
15100
|
mType = MediaType.AUDIO;
|
|
15115
15101
|
if (user.audioTrack) {
|
|
15116
15102
|
user.audioTrack.track = undefined;
|
|
@@ -15119,7 +15105,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15119
15105
|
this._stats.remoteAudio.stopSubscribe(user);
|
|
15120
15106
|
return [2 /*return*/, this._engine.unsubscribeStream(String(user.uid), mType)];
|
|
15121
15107
|
}
|
|
15122
|
-
if (mediaType === '
|
|
15108
|
+
if (mediaType === 'video' && flag === 'sub') {
|
|
15123
15109
|
mType = MediaType.VIDEO;
|
|
15124
15110
|
if (user.screenTrack) {
|
|
15125
15111
|
user.screenTrack.track = undefined;
|
|
@@ -15127,7 +15113,15 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15127
15113
|
user.screenTrack = undefined;
|
|
15128
15114
|
return [2 /*return*/, this._engine.unsubscribeScreen(String(user.uid), mType)];
|
|
15129
15115
|
}
|
|
15130
|
-
if (
|
|
15116
|
+
if (mediaType === 'audio' && flag === 'sub') {
|
|
15117
|
+
mType = MediaType.AUDIO;
|
|
15118
|
+
if (user.screenAudioTrack) {
|
|
15119
|
+
user.screenAudioTrack.track = undefined;
|
|
15120
|
+
}
|
|
15121
|
+
user.screenAudioTrack = undefined;
|
|
15122
|
+
return [2 /*return*/, this._engine.unsubscribeScreen(String(user.uid), mType)];
|
|
15123
|
+
}
|
|
15124
|
+
if (!(!mediaType && flag === 'main')) return [3 /*break*/, 2];
|
|
15131
15125
|
mType = MediaType.AUDIO_AND_VIDEO;
|
|
15132
15126
|
if (user.videoTrack) {
|
|
15133
15127
|
user.videoTrack.track = undefined;
|
|
@@ -15142,11 +15136,23 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15142
15136
|
return [4 /*yield*/, this._engine.unsubscribeStream(String(user.uid), mType)];
|
|
15143
15137
|
case 1:
|
|
15144
15138
|
_a.sent();
|
|
15145
|
-
|
|
15139
|
+
_a.label = 2;
|
|
15146
15140
|
case 2:
|
|
15141
|
+
if (!(!mediaType && flag === 'sub')) return [3 /*break*/, 4];
|
|
15142
|
+
mType = MediaType.AUDIO_AND_VIDEO;
|
|
15143
|
+
if (user.screenTrack) {
|
|
15144
|
+
user.screenTrack.track = undefined;
|
|
15145
|
+
}
|
|
15146
|
+
if (user.screenAudioTrack) {
|
|
15147
|
+
user.screenAudioTrack.track = undefined;
|
|
15148
|
+
}
|
|
15149
|
+
user.screenTrack = undefined;
|
|
15150
|
+
user.screenAudioTrack = undefined;
|
|
15151
|
+
return [4 /*yield*/, this._engine.unsubscribeScreen(String(user.uid), mType)];
|
|
15152
|
+
case 3:
|
|
15147
15153
|
_a.sent();
|
|
15148
|
-
_a.label =
|
|
15149
|
-
case
|
|
15154
|
+
_a.label = 4;
|
|
15155
|
+
case 4: return [2 /*return*/];
|
|
15150
15156
|
}
|
|
15151
15157
|
});
|
|
15152
15158
|
});
|
|
@@ -15519,7 +15525,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
15519
15525
|
// }
|
|
15520
15526
|
// P0
|
|
15521
15527
|
VolcCoreRTC.prototype.createCameraVideoTrack = function (config) {
|
|
15522
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15528
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15523
15529
|
var localVideoTrack, cameraVideoTrack;
|
|
15524
15530
|
return __generator(this, function (_a) {
|
|
15525
15531
|
switch (_a.label) {
|
|
@@ -15577,7 +15583,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
15577
15583
|
};
|
|
15578
15584
|
// P0
|
|
15579
15585
|
VolcCoreRTC.prototype.createMicrophoneAndCameraTracks = function (audioConfig, videoConfig) {
|
|
15580
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15586
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15581
15587
|
var localAudioTrack, localVideoTrack, microphoneAudioTrack, cameraVideoTrack;
|
|
15582
15588
|
return __generator(this, function (_a) {
|
|
15583
15589
|
switch (_a.label) {
|
|
@@ -15629,7 +15635,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
15629
15635
|
};
|
|
15630
15636
|
// P0
|
|
15631
15637
|
VolcCoreRTC.prototype.createMicrophoneAudioTrack = function (config) {
|
|
15632
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15638
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15633
15639
|
var localAudioTrack, res;
|
|
15634
15640
|
return __generator(this, function (_a) {
|
|
15635
15641
|
switch (_a.label) {
|
|
@@ -15663,7 +15669,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
15663
15669
|
};
|
|
15664
15670
|
// P0
|
|
15665
15671
|
VolcCoreRTC.prototype.createScreenVideoTrack = function (config, withAudio) {
|
|
15666
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15672
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15667
15673
|
var _a, selfBrowserSurface, localVideoTrack, localAudioTrack, screenVideoTrack, screenAudioTrack;
|
|
15668
15674
|
return __generator(this, function (_b) {
|
|
15669
15675
|
switch (_b.label) {
|
|
@@ -15701,7 +15707,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
15701
15707
|
};
|
|
15702
15708
|
// P0
|
|
15703
15709
|
VolcCoreRTC.prototype.getSupportedCodec = function () {
|
|
15704
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15710
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15705
15711
|
var videoCodecs, res;
|
|
15706
15712
|
return __generator(this, function (_a) {
|
|
15707
15713
|
switch (_a.label) {
|
|
@@ -15723,7 +15729,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
15723
15729
|
};
|
|
15724
15730
|
// P0, skipPermissionCheck 可以不考虑
|
|
15725
15731
|
VolcCoreRTC.prototype.getDevices = function (skipPermissionCheck) {
|
|
15726
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15732
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15727
15733
|
var devices;
|
|
15728
15734
|
return __generator(this, function (_a) {
|
|
15729
15735
|
switch (_a.label) {
|
|
@@ -15738,7 +15744,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
15738
15744
|
};
|
|
15739
15745
|
// P0, skipPermissionCheck 可以不考虑
|
|
15740
15746
|
VolcCoreRTC.prototype.getMicrophones = function (skipPermissionCheck) {
|
|
15741
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15747
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15742
15748
|
var devices, audioInputs;
|
|
15743
15749
|
return __generator(this, function (_a) {
|
|
15744
15750
|
switch (_a.label) {
|
|
@@ -15754,7 +15760,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
15754
15760
|
};
|
|
15755
15761
|
// P0, skipPermissionCheck 可以不考虑
|
|
15756
15762
|
VolcCoreRTC.prototype.getCameras = function (skipPermissionCheck) {
|
|
15757
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15763
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15758
15764
|
var devices, videoInputs;
|
|
15759
15765
|
return __generator(this, function (_a) {
|
|
15760
15766
|
switch (_a.label) {
|
|
@@ -15789,7 +15795,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
15789
15795
|
};
|
|
15790
15796
|
// P0, skipPermissionCheck 可以不考虑
|
|
15791
15797
|
VolcCoreRTC.prototype.getPlaybackDevices = function (skipPermissionCheck) {
|
|
15792
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15798
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15793
15799
|
var devices, audioOutputs;
|
|
15794
15800
|
return __generator(this, function (_a) {
|
|
15795
15801
|
switch (_a.label) {
|
|
@@ -16002,6 +16008,8 @@ var VolcCoreRTCWrapper = /** @class */ (function () {
|
|
|
16002
16008
|
this._engine = VERTC.createEngine(this._appId, {
|
|
16003
16009
|
autoPlayPolicy: RTCAutoPlayPolicy.PLAY_MANUALLY,
|
|
16004
16010
|
});
|
|
16011
|
+
// @ts-ignore
|
|
16012
|
+
window.__rtc_engine__ = this._engine;
|
|
16005
16013
|
this._engine.setUserVisibility(false);
|
|
16006
16014
|
VolcCoreRTC$1.setEngine(this._engine);
|
|
16007
16015
|
VolcCoreRTC$1.setUserInfo({
|
|
@@ -16029,6 +16037,7 @@ var VolcCoreRTCWrapper = /** @class */ (function () {
|
|
|
16029
16037
|
token: this._token,
|
|
16030
16038
|
plan: this._plan,
|
|
16031
16039
|
type: RTCEngineType.VolcEngine,
|
|
16040
|
+
prefix: config.streamPrefix,
|
|
16032
16041
|
});
|
|
16033
16042
|
};
|
|
16034
16043
|
// P1 下一期实现
|
|
@@ -16230,14 +16239,14 @@ function getRTCInstance(token, extraInfo) {
|
|
|
16230
16239
|
var data = lib(token);
|
|
16231
16240
|
console.log('token data: ', data);
|
|
16232
16241
|
switch (data.type) {
|
|
16233
|
-
case RTCEngineType.Agora:
|
|
16234
|
-
|
|
16235
|
-
|
|
16236
|
-
|
|
16237
|
-
|
|
16238
|
-
|
|
16239
|
-
|
|
16240
|
-
|
|
16242
|
+
// case RTCEngineType.Agora:
|
|
16243
|
+
// return new AgoraRTC({
|
|
16244
|
+
// appId: data.appid,
|
|
16245
|
+
// roomId: data.roomStr,
|
|
16246
|
+
// userId: data.user,
|
|
16247
|
+
// sdkToken: data.attachToken || data.token,
|
|
16248
|
+
// plan: data.planid,
|
|
16249
|
+
// })
|
|
16241
16250
|
case RTCEngineType.Core:
|
|
16242
16251
|
return new CoreRTC$1({
|
|
16243
16252
|
appId: data.appid,
|