omnirtc-web 1.3.2 → 1.3.3-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 +505 -504
- package/dist/omnirtc-web.js +509 -508
- 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.3.3-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
|
|
|
@@ -2575,19 +2427,19 @@ validateRtpParameters(videoRtpParameters);var rtpParameters={mid:RTP_PROBATOR_MI
|
|
|
2575
2427
|
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.
|
|
2576
2428
|
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.
|
|
2577
2429
|
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.
|
|
2578
|
-
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
|
|
2430
|
+
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.
|
|
2579
2431
|
this.closed=false;// Queue of pending tasks.
|
|
2580
2432
|
this.pendingTasks=[];// Error class used when rejecting a task due to AwaitQueue being closed.
|
|
2581
2433
|
this.ClosedErrorClass=Error;// Error class used when rejecting a task due to AwaitQueue being stopped.
|
|
2582
2434
|
this.StoppedErrorClass=Error;// Error class used when removing a pending task when calling removeTask().
|
|
2583
2435
|
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.
|
|
2584
|
-
}catch(err){_iterator22.e(err);}finally{_iterator22.f();}this.pendingTasks.length=0;}},{key:"push",value:function push(task,name){return __awaiter
|
|
2436
|
+
}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.
|
|
2585
2437
|
_this38.pendingTasks.push(pendingTask);// And run it if this is the only task in the queue.
|
|
2586
2438
|
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.
|
|
2587
|
-
}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
|
|
2439
|
+
}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.
|
|
2588
2440
|
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.
|
|
2589
2441
|
this.pendingTasks.shift();// And continue.
|
|
2590
|
-
this.next();case 7:case"end":return _context8.stop();}},_callee7,this);}));}},{key:"executeTask",value:function executeTask(pendingTask){return __awaiter
|
|
2442
|
+
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).
|
|
2591
2443
|
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.
|
|
2592
2444
|
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){/**
|
|
2593
2445
|
* @emits transportclose
|
|
@@ -6159,21 +6011,187 @@ _stream.addTrack(track.track);context=getAudioContext();source=context.createMed
|
|
|
6159
6011
|
* @ignore
|
|
6160
6012
|
*/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]]);}));}
|
|
6161
6013
|
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6014
|
+
/*! *****************************************************************************
|
|
6015
|
+
Copyright (c) Microsoft Corporation.
|
|
6016
|
+
|
|
6017
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6018
|
+
purpose with or without fee is hereby granted.
|
|
6019
|
+
|
|
6020
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
6021
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
6022
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
6023
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
6024
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
6025
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
6026
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
6027
|
+
***************************************************************************** */
|
|
6028
|
+
/* global Reflect, Promise */
|
|
6029
|
+
|
|
6030
|
+
var extendStatics = function(d, b) {
|
|
6031
|
+
extendStatics = Object.setPrototypeOf ||
|
|
6032
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6033
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6034
|
+
return extendStatics(d, b);
|
|
6035
|
+
};
|
|
6036
|
+
|
|
6037
|
+
function __extends(d, b) {
|
|
6038
|
+
extendStatics(d, b);
|
|
6039
|
+
function __() { this.constructor = d; }
|
|
6040
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
6041
|
+
}
|
|
6042
|
+
|
|
6043
|
+
var __assign = function() {
|
|
6044
|
+
__assign = Object.assign || function __assign(t) {
|
|
6045
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6046
|
+
s = arguments[i];
|
|
6047
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6048
|
+
}
|
|
6049
|
+
return t;
|
|
6050
|
+
};
|
|
6051
|
+
return __assign.apply(this, arguments);
|
|
6052
|
+
};
|
|
6053
|
+
|
|
6054
|
+
function __decorate(decorators, target, key, desc) {
|
|
6055
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6056
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6057
|
+
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;
|
|
6058
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6059
|
+
}
|
|
6060
|
+
|
|
6061
|
+
function __awaiter$2(thisArg, _arguments, P, generator) {
|
|
6062
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6063
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6064
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6065
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6066
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6067
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6068
|
+
});
|
|
6069
|
+
}
|
|
6070
|
+
|
|
6071
|
+
function __generator(thisArg, body) {
|
|
6072
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
6073
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
6074
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
6075
|
+
function step(op) {
|
|
6076
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
6077
|
+
while (_) try {
|
|
6078
|
+
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;
|
|
6079
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
6080
|
+
switch (op[0]) {
|
|
6081
|
+
case 0: case 1: t = op; break;
|
|
6082
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
6083
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
6084
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
6085
|
+
default:
|
|
6086
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
6087
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
6088
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
6089
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
6090
|
+
if (t[2]) _.ops.pop();
|
|
6091
|
+
_.trys.pop(); continue;
|
|
6092
|
+
}
|
|
6093
|
+
op = body.call(thisArg, _);
|
|
6094
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
6095
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
6096
|
+
}
|
|
6097
|
+
}
|
|
6098
|
+
|
|
6099
|
+
function __values(o) {
|
|
6100
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
6101
|
+
if (m) return m.call(o);
|
|
6102
|
+
if (o && typeof o.length === "number") return {
|
|
6103
|
+
next: function () {
|
|
6104
|
+
if (o && i >= o.length) o = void 0;
|
|
6105
|
+
return { value: o && o[i++], done: !o };
|
|
6106
|
+
}
|
|
6107
|
+
};
|
|
6108
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
6109
|
+
}
|
|
6110
|
+
|
|
6111
|
+
function __read(o, n) {
|
|
6112
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
6113
|
+
if (!m) return o;
|
|
6114
|
+
var i = m.call(o), r, ar = [], e;
|
|
6115
|
+
try {
|
|
6116
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
6117
|
+
}
|
|
6118
|
+
catch (error) { e = { error: error }; }
|
|
6119
|
+
finally {
|
|
6120
|
+
try {
|
|
6121
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
6122
|
+
}
|
|
6123
|
+
finally { if (e) throw e.error; }
|
|
6124
|
+
}
|
|
6125
|
+
return ar;
|
|
6126
|
+
}
|
|
6127
|
+
|
|
6128
|
+
function __spread() {
|
|
6129
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
6130
|
+
ar = ar.concat(__read(arguments[i]));
|
|
6131
|
+
return ar;
|
|
6132
|
+
}
|
|
6133
|
+
|
|
6134
|
+
var defineProperty = createCommonjsModule(function (module) {
|
|
6135
|
+
function _defineProperty(e, r, t) {
|
|
6136
|
+
return (r = toPropertyKey_1(r)) in e ? Object.defineProperty(e, r, {
|
|
6137
|
+
value: t,
|
|
6138
|
+
enumerable: !0,
|
|
6139
|
+
configurable: !0,
|
|
6140
|
+
writable: !0
|
|
6141
|
+
}) : e[r] = t, e;
|
|
6142
|
+
}
|
|
6143
|
+
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
6144
|
+
});
|
|
6145
|
+
var _defineProperty = /*@__PURE__*/getDefaultExportFromCjs(defineProperty);
|
|
6146
|
+
|
|
6147
|
+
var AgoraRTC = /*#__PURE__*/_createClass(function AgoraRTC() {
|
|
6148
|
+
_classCallCheck(this, AgoraRTC);
|
|
6149
|
+
throw new Error('AgoraRTC is not available in this environment.');
|
|
6150
|
+
});
|
|
6151
|
+
_defineProperty(AgoraRTC, "VERSION", null);
|
|
6152
|
+
|
|
6153
|
+
var Tools = /** @class */ (function () {
|
|
6154
|
+
function Tools() {
|
|
6155
|
+
}
|
|
6156
|
+
Tools.asyncSleep = function (timeMs) {
|
|
6157
|
+
return new Promise(function (resolve) {
|
|
6158
|
+
setTimeout(resolve, timeMs);
|
|
6159
|
+
});
|
|
6160
|
+
};
|
|
6161
|
+
Tools.randomString = function (length) {
|
|
6162
|
+
var result = '';
|
|
6163
|
+
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
6164
|
+
var charactersLength = characters.length;
|
|
6165
|
+
for (var i = 0; i < length; i++) {
|
|
6166
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
6167
|
+
}
|
|
6168
|
+
return result;
|
|
6169
|
+
};
|
|
6170
|
+
Tools.getDiffTimeMs = function (oldTime) {
|
|
6171
|
+
return Date.now() - oldTime;
|
|
6172
|
+
};
|
|
6173
|
+
Tools.fetch = function (url, data, method) {
|
|
6174
|
+
if (method === void 0) { method = 'POST'; }
|
|
6175
|
+
return new Promise(function (resolve, reject) {
|
|
6176
|
+
var xhr = new XMLHttpRequest();
|
|
6177
|
+
xhr.timeout = 3000;
|
|
6178
|
+
xhr.open(method, url);
|
|
6179
|
+
xhr.onreadystatechange = function () {
|
|
6180
|
+
if (xhr.readyState < 4) {
|
|
6181
|
+
return;
|
|
6182
|
+
}
|
|
6183
|
+
if (xhr.status > 199 && xhr.status < 300) {
|
|
6184
|
+
resolve();
|
|
6185
|
+
}
|
|
6186
|
+
else {
|
|
6187
|
+
reject();
|
|
6188
|
+
}
|
|
6189
|
+
};
|
|
6190
|
+
xhr.send(data);
|
|
6191
|
+
});
|
|
6192
|
+
};
|
|
6193
|
+
return Tools;
|
|
6194
|
+
}());
|
|
6177
6195
|
|
|
6178
6196
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
6179
6197
|
var R$1 = (typeof Reflect === "undefined" ? "undefined" : _typeof$1(Reflect)) === 'object' ? Reflect : null;
|
|
@@ -6713,7 +6731,7 @@ var StatisticDynamicHelper = /** @class */ (function (_super) {
|
|
|
6713
6731
|
}
|
|
6714
6732
|
};
|
|
6715
6733
|
StatisticDynamicHelper.prototype.getStatsLoop = function () {
|
|
6716
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
6734
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
6717
6735
|
var _this = this;
|
|
6718
6736
|
return __generator(this, function (_a) {
|
|
6719
6737
|
switch (_a.label) {
|
|
@@ -6742,7 +6760,7 @@ var StatisticDynamicHelper = /** @class */ (function (_super) {
|
|
|
6742
6760
|
});
|
|
6743
6761
|
};
|
|
6744
6762
|
StatisticDynamicHelper.prototype.startMainLoop = function () {
|
|
6745
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
6763
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
6746
6764
|
var localStats, videoStats, audioStats, avgStatsMap, _a, _b, _c, senderId, audioArray, remoteAudioStats, _d, _e, _f, senderId, videoArray, remoteVideoStats, remoteStatsArray, _g, _h, senderId, value;
|
|
6747
6765
|
var e_1, _j, e_2, _k, e_3, _l;
|
|
6748
6766
|
return __generator(this, function (_m) {
|
|
@@ -8188,7 +8206,7 @@ var StatisticLog = /** @class */ (function (_super) {
|
|
|
8188
8206
|
this.sendQueue.push(frame);
|
|
8189
8207
|
};
|
|
8190
8208
|
StatisticLog.prototype.run = function () {
|
|
8191
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
8209
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
8192
8210
|
var frame;
|
|
8193
8211
|
var _this = this;
|
|
8194
8212
|
return __generator(this, function (_a) {
|
|
@@ -8286,7 +8304,7 @@ var LogFrame = /** @class */ (function (_super) {
|
|
|
8286
8304
|
};
|
|
8287
8305
|
};
|
|
8288
8306
|
LogFrame.prototype.send = function (publicUserInfo, commonInfo) {
|
|
8289
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
8307
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
8290
8308
|
var success, data, e_1;
|
|
8291
8309
|
return __generator(this, function (_a) {
|
|
8292
8310
|
switch (_a.label) {
|
|
@@ -8343,36 +8361,74 @@ function getStreamLogType(audio, video) {
|
|
|
8343
8361
|
}
|
|
8344
8362
|
}
|
|
8345
8363
|
|
|
8346
|
-
var
|
|
8364
|
+
var Emitter = /** @class */ (function () {
|
|
8365
|
+
function Emitter() {
|
|
8366
|
+
this._emitter = new events$1();
|
|
8367
|
+
}
|
|
8368
|
+
Emitter.prototype.on = function (event, listener) {
|
|
8369
|
+
this._emitter.on(event, listener);
|
|
8370
|
+
};
|
|
8371
|
+
Emitter.prototype.once = function (event, listener) {
|
|
8372
|
+
this._emitter.once(event, listener);
|
|
8373
|
+
};
|
|
8374
|
+
Emitter.prototype.off = function (event, listener) {
|
|
8375
|
+
this._emitter.off(event, listener);
|
|
8376
|
+
};
|
|
8377
|
+
Emitter.prototype.removeAllListeners = function (event) {
|
|
8378
|
+
this._emitter.removeAllListeners(event);
|
|
8379
|
+
};
|
|
8380
|
+
Emitter.prototype.getListeners = function (event) {
|
|
8381
|
+
return this._emitter.listeners(event);
|
|
8382
|
+
};
|
|
8383
|
+
Emitter.prototype.emit = function (event) {
|
|
8384
|
+
var _a;
|
|
8385
|
+
var args = [];
|
|
8386
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
8387
|
+
args[_i - 1] = arguments[_i];
|
|
8388
|
+
}
|
|
8389
|
+
(_a = this._emitter).emit.apply(_a, __spread([event], args));
|
|
8390
|
+
};
|
|
8391
|
+
return Emitter;
|
|
8392
|
+
}());
|
|
8393
|
+
|
|
8394
|
+
var Client = /** @class */ (function (_super) {
|
|
8395
|
+
__extends(Client, _super);
|
|
8347
8396
|
function Client(client, _a) {
|
|
8348
|
-
var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, token = _a.token, type = _a.type, plan = _a.plan;
|
|
8349
|
-
|
|
8350
|
-
|
|
8397
|
+
var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, token = _a.token, type = _a.type, prefix = _a.prefix, plan = _a.plan;
|
|
8398
|
+
var _this = _super.call(this) || this;
|
|
8399
|
+
_this._reconnectTimestamp = 0; // 开始重连的时间戳
|
|
8400
|
+
_this._reconnectTimes = 0; // 重连次数
|
|
8401
|
+
_this._userMap = new Map();
|
|
8351
8402
|
// for log
|
|
8352
|
-
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
|
|
8357
|
-
|
|
8358
|
-
|
|
8359
|
-
|
|
8360
|
-
|
|
8403
|
+
_this.roomState = 'init';
|
|
8404
|
+
_this._appId = appId;
|
|
8405
|
+
_this._roomId = roomId;
|
|
8406
|
+
_this._userId = userId;
|
|
8407
|
+
_this._token = token;
|
|
8408
|
+
_this._client = client;
|
|
8409
|
+
_this._type = type;
|
|
8410
|
+
_this._plan = plan;
|
|
8411
|
+
_this._statisticLog = new StatisticLog();
|
|
8412
|
+
_this._prefix = prefix;
|
|
8361
8413
|
switch (type) {
|
|
8362
8414
|
case RTCEngineType.Agora:
|
|
8363
|
-
|
|
8415
|
+
_this._engineVersion = AgoraRTC.VERSION;
|
|
8364
8416
|
break;
|
|
8365
8417
|
case RTCEngineType.Core:
|
|
8366
|
-
|
|
8418
|
+
_this._engineVersion = coreRTC.VERSION;
|
|
8367
8419
|
break;
|
|
8368
8420
|
case RTCEngineType.VolcEngine:
|
|
8369
|
-
|
|
8421
|
+
_this._engineVersion = VERTC.getSdkVersion();
|
|
8370
8422
|
break;
|
|
8423
|
+
// case RTCEngineType.Agora:
|
|
8424
|
+
// this._engineVersion = Agora.VERSION;
|
|
8425
|
+
// break;
|
|
8371
8426
|
default:
|
|
8372
|
-
|
|
8427
|
+
_this._engineVersion = null;
|
|
8373
8428
|
break;
|
|
8374
8429
|
}
|
|
8375
|
-
bindListeners(
|
|
8430
|
+
_this.bindListeners();
|
|
8431
|
+
return _this;
|
|
8376
8432
|
}
|
|
8377
8433
|
Object.defineProperty(Client.prototype, "connectionState", {
|
|
8378
8434
|
get: function () {
|
|
@@ -8409,21 +8465,6 @@ var Client = /** @class */ (function () {
|
|
|
8409
8465
|
enumerable: false,
|
|
8410
8466
|
configurable: true
|
|
8411
8467
|
});
|
|
8412
|
-
Client.prototype.on = function (event, listener) {
|
|
8413
|
-
return this._client.on(event, listener);
|
|
8414
|
-
};
|
|
8415
|
-
Client.prototype.once = function (event, listener) {
|
|
8416
|
-
return this._client.once(event, listener);
|
|
8417
|
-
};
|
|
8418
|
-
Client.prototype.off = function (event, listener) {
|
|
8419
|
-
return this._client.off(event, listener);
|
|
8420
|
-
};
|
|
8421
|
-
Client.prototype.removeAllListeners = function (event) {
|
|
8422
|
-
this._client.removeAllListeners(event);
|
|
8423
|
-
if (!event || event === 'connection-state-change') {
|
|
8424
|
-
bindListeners(this);
|
|
8425
|
-
}
|
|
8426
|
-
};
|
|
8427
8468
|
Client.prototype.join = function () {
|
|
8428
8469
|
var _this = this;
|
|
8429
8470
|
// @ts-ignore
|
|
@@ -8516,7 +8557,7 @@ var Client = /** @class */ (function () {
|
|
|
8516
8557
|
});
|
|
8517
8558
|
};
|
|
8518
8559
|
Client.prototype.unpublish = function (tracks) {
|
|
8519
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
8560
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
8520
8561
|
var localTracks;
|
|
8521
8562
|
var _this = this;
|
|
8522
8563
|
return __generator(this, function (_a) {
|
|
@@ -8542,10 +8583,14 @@ var Client = /** @class */ (function () {
|
|
|
8542
8583
|
});
|
|
8543
8584
|
});
|
|
8544
8585
|
};
|
|
8545
|
-
|
|
8586
|
+
// @ts-ignore
|
|
8587
|
+
Client.prototype.subscribe = function (streamId, mediaType) {
|
|
8546
8588
|
var _this = this;
|
|
8547
8589
|
var startTime = Date.now();
|
|
8548
|
-
|
|
8590
|
+
var user = this._userMap.get(streamId);
|
|
8591
|
+
var flag = streamId.split('_')[3];
|
|
8592
|
+
// @ts-ignore
|
|
8593
|
+
return this._client.subscribe(user, mediaType, flag).then(function (track) {
|
|
8549
8594
|
track.on('first-frame-decoded', function () {
|
|
8550
8595
|
_this._statisticLog.emit('first-frame', FirstFrame[track.trackMediaType], track.getUserId());
|
|
8551
8596
|
});
|
|
@@ -8588,9 +8633,12 @@ var Client = /** @class */ (function () {
|
|
|
8588
8633
|
return track;
|
|
8589
8634
|
});
|
|
8590
8635
|
};
|
|
8591
|
-
Client.prototype.unsubscribe = function (
|
|
8636
|
+
Client.prototype.unsubscribe = function (streamId, mediaType) {
|
|
8592
8637
|
var _this = this;
|
|
8593
|
-
|
|
8638
|
+
var user = this._userMap.get(streamId);
|
|
8639
|
+
var flag = streamId.split('_')[3];
|
|
8640
|
+
// @ts-ignore
|
|
8641
|
+
return this._client.unsubscribe(user, mediaType, flag).then(function () {
|
|
8594
8642
|
_this._statisticLog.emit('unsubscribed', null, mediaType === 'audio', mediaType === 'video', user.uid);
|
|
8595
8643
|
return;
|
|
8596
8644
|
});
|
|
@@ -8652,12 +8700,6 @@ var Client = /** @class */ (function () {
|
|
|
8652
8700
|
Client.prototype.stopLiveStreaming = function (url) {
|
|
8653
8701
|
return this._client.stopLiveStreaming(url);
|
|
8654
8702
|
};
|
|
8655
|
-
Client.prototype.addInjectStreamUrl = function (url, config) {
|
|
8656
|
-
return this._client.addInjectStreamUrl(url, config);
|
|
8657
|
-
};
|
|
8658
|
-
Client.prototype.removeInjectStreamUrl = function () {
|
|
8659
|
-
return this._client.removeInjectStreamUrl();
|
|
8660
|
-
};
|
|
8661
8703
|
Client.prototype.startChannelMediaRelay = function (config) {
|
|
8662
8704
|
return this._client.startChannelMediaRelay(config);
|
|
8663
8705
|
};
|
|
@@ -8685,191 +8727,114 @@ var Client = /** @class */ (function () {
|
|
|
8685
8727
|
Client.prototype.getRemoteVideoStats = function () {
|
|
8686
8728
|
return this._client.getRemoteVideoStats();
|
|
8687
8729
|
};
|
|
8688
|
-
Client.prototype.
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
|
|
8695
|
-
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8730
|
+
Client.prototype.bindListeners = function () {
|
|
8731
|
+
var _this = this;
|
|
8732
|
+
this._client.on('connection-state-change', function (curState, revState, msg) {
|
|
8733
|
+
if (curState === 'DISCONNECTED') {
|
|
8734
|
+
var reason = '', stateReason = '';
|
|
8735
|
+
switch (msg) {
|
|
8736
|
+
case 'SERVER_ERROR':
|
|
8737
|
+
case 'NETWORK_ERROR': {
|
|
8738
|
+
reason = StatisticLog.DisconnectReason.NETWORK;
|
|
8739
|
+
stateReason = 'interrupted';
|
|
8740
|
+
break;
|
|
8741
|
+
}
|
|
8742
|
+
case 'LEAVE': {
|
|
8743
|
+
reason = StatisticLog.DisconnectReason.CLIENT;
|
|
8744
|
+
stateReason = 'leave_channel';
|
|
8745
|
+
break;
|
|
8746
|
+
}
|
|
8747
|
+
case 'IP_BANNED':
|
|
8748
|
+
case 'CHANNEL_BANNED':
|
|
8749
|
+
case 'UID_BANNED': {
|
|
8750
|
+
reason = StatisticLog.DisconnectReason.SERVER;
|
|
8751
|
+
stateReason = 'banned_by_server';
|
|
8752
|
+
break;
|
|
8753
|
+
}
|
|
8708
8754
|
}
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
stateReason = 'banned_by_server';
|
|
8714
|
-
break;
|
|
8755
|
+
_this._statisticLog.emit('connection-state', OmniConnectionState.Disconnected, stateReason);
|
|
8756
|
+
_this._statisticLog.emit('disconnected', reason, '');
|
|
8757
|
+
if (_this._statisticLog && reason !== StatisticLog.DisconnectReason.NETWORK) {
|
|
8758
|
+
_this._statisticLog.stop();
|
|
8715
8759
|
}
|
|
8716
8760
|
}
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
client._statisticLog.stop();
|
|
8761
|
+
if (curState === 'RECONNECTING') {
|
|
8762
|
+
_this._reconnectTimestamp = Date.now();
|
|
8763
|
+
_this._reconnectTimes += 1;
|
|
8721
8764
|
}
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
}
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8765
|
+
if (curState === 'CONNECTED' && revState === 'RECONNECTING') {
|
|
8766
|
+
_this._statisticLog.emit('joined', false, 0, 1);
|
|
8767
|
+
_this._statisticLog.emit('reconnected', _this._reconnectTimestamp, Date.now(), _this._reconnectTimes);
|
|
8768
|
+
}
|
|
8769
|
+
_this.emit('connection-state-change', curState, msg);
|
|
8770
|
+
});
|
|
8771
|
+
this._client.on('user-joined', function (user) {
|
|
8772
|
+
_this.emit('user-joined', user);
|
|
8773
|
+
});
|
|
8774
|
+
this._client.on('user-left', function (user, reason) {
|
|
8775
|
+
_this.emit('user-left', user, reason);
|
|
8776
|
+
});
|
|
8777
|
+
this._client.on('user-published', function (user, mediaType, flag) {
|
|
8778
|
+
var userId = user.uid;
|
|
8779
|
+
if (_this._type === RTCEngineType.Agora) {
|
|
8780
|
+
flag = streamFlagMap[userId >>> 30];
|
|
8781
|
+
userId = parseAgoraUserId(userId, flag);
|
|
8782
|
+
}
|
|
8783
|
+
if (_this._type === RTCEngineType.Core) {
|
|
8784
|
+
flag = 'main';
|
|
8785
|
+
}
|
|
8786
|
+
var streamId = _this._prefix + "_" + _this._roomId + "_" + userId + "_" + flag;
|
|
8787
|
+
_this._userMap.set(streamId, user);
|
|
8788
|
+
// @ts-ignore
|
|
8789
|
+
_this.emit('user-published', user, mediaType, streamId);
|
|
8790
|
+
});
|
|
8791
|
+
this._client.on('user-unpublished', function (user, mediaType, flag) {
|
|
8792
|
+
var userId = user.uid;
|
|
8793
|
+
if (_this._type === RTCEngineType.Agora) {
|
|
8794
|
+
flag = streamFlagMap[userId >>> 30];
|
|
8795
|
+
userId = parseAgoraUserId(userId, flag);
|
|
8796
|
+
}
|
|
8797
|
+
if (_this._type === RTCEngineType.Core) {
|
|
8798
|
+
flag = 'main';
|
|
8799
|
+
}
|
|
8800
|
+
var streamId = _this._prefix + "_" + _this._roomId + "_" + userId + "_" + flag;
|
|
8801
|
+
_this._userMap.delete(streamId);
|
|
8802
|
+
// @ts-ignore
|
|
8803
|
+
_this.emit('user-unpublished', user, mediaType, streamId);
|
|
8804
|
+
});
|
|
8805
|
+
this._client.on('user-info-updated', function (uid, msg) {
|
|
8806
|
+
_this.emit('user-info-updated', uid, msg);
|
|
8807
|
+
});
|
|
8808
|
+
this._client.on('media-reconnect-start', function (uid) {
|
|
8809
|
+
_this.emit('media-reconnect-start', uid);
|
|
8810
|
+
});
|
|
8811
|
+
this._client.on('media-reconnect-end', function (uid) {
|
|
8812
|
+
_this.emit('media-reconnect-end', uid);
|
|
8813
|
+
});
|
|
8814
|
+
this._client.on('volume-indicator', function (result) {
|
|
8815
|
+
_this.emit('volume-indicator', result);
|
|
8816
|
+
});
|
|
8817
|
+
this._client.on('token-privilege-will-expire', function () {
|
|
8818
|
+
_this.emit('token-privilege-will-expire');
|
|
8819
|
+
});
|
|
8820
|
+
this._client.on('token-privilege-did-expire', function () {
|
|
8821
|
+
_this.emit('token-privilege-did-expire');
|
|
8822
|
+
});
|
|
8823
|
+
this._client.on('exception', function (result) {
|
|
8824
|
+
_this.emit('exception', result);
|
|
8756
8825
|
});
|
|
8757
8826
|
};
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
};
|
|
8770
|
-
AgoraRTC.prototype.createMicrophoneAndCameraTracks = function (audioConfig, videoConfig) {
|
|
8771
|
-
return Agora.createMicrophoneAndCameraTracks(audioConfig, videoConfig);
|
|
8772
|
-
};
|
|
8773
|
-
AgoraRTC.prototype.createMicrophoneAudioTrack = function (config) {
|
|
8774
|
-
return Agora.createMicrophoneAudioTrack(config);
|
|
8775
|
-
};
|
|
8776
|
-
AgoraRTC.prototype.createScreenVideoTrack = function (config, withAudio) {
|
|
8777
|
-
return Agora.createScreenVideoTrack(config, withAudio);
|
|
8778
|
-
};
|
|
8779
|
-
AgoraRTC.prototype.getSupportedCodec = function () {
|
|
8780
|
-
return Agora.getSupportedCodec();
|
|
8781
|
-
};
|
|
8782
|
-
AgoraRTC.prototype.checkSystemRequirements = function () {
|
|
8783
|
-
return Agora.checkSystemRequirements();
|
|
8784
|
-
};
|
|
8785
|
-
AgoraRTC.prototype.getDevices = function (skipPermissionCheck) {
|
|
8786
|
-
return Agora.getDevices(skipPermissionCheck);
|
|
8787
|
-
};
|
|
8788
|
-
AgoraRTC.prototype.getMicrophones = function (skipPermissionCheck) {
|
|
8789
|
-
return Agora.getMicrophones(skipPermissionCheck);
|
|
8790
|
-
};
|
|
8791
|
-
AgoraRTC.prototype.getCameras = function (skipPermissionCheck) {
|
|
8792
|
-
return Agora.getCameras(skipPermissionCheck);
|
|
8793
|
-
};
|
|
8794
|
-
AgoraRTC.prototype.getPlaybackDevices = function (skipPermissionCheck) {
|
|
8795
|
-
return Agora.getPlaybackDevices(skipPermissionCheck);
|
|
8796
|
-
};
|
|
8797
|
-
AgoraRTC.prototype.getElectronScreenSources = function (type) {
|
|
8798
|
-
return Agora.getElectronScreenSources(type);
|
|
8799
|
-
};
|
|
8800
|
-
AgoraRTC.prototype.setLogLevel = function (level) {
|
|
8801
|
-
return Agora.setLogLevel(level);
|
|
8802
|
-
};
|
|
8803
|
-
AgoraRTC.prototype.enableLogUpload = function () {
|
|
8804
|
-
return Agora.enableLogUpload();
|
|
8805
|
-
};
|
|
8806
|
-
AgoraRTC.prototype.disableLogUpload = function () {
|
|
8807
|
-
return Agora.disableLogUpload();
|
|
8808
|
-
};
|
|
8809
|
-
AgoraRTC.prototype.checkVideoTrackIsActive = function (track, timeout) {
|
|
8810
|
-
return Agora.checkVideoTrackIsActive(track, timeout);
|
|
8811
|
-
};
|
|
8812
|
-
AgoraRTC.prototype.checkAudioTrackIsActive = function (track, timeout) {
|
|
8813
|
-
return Agora.checkAudioTrackIsActive(track, timeout);
|
|
8814
|
-
};
|
|
8815
|
-
Object.defineProperty(AgoraRTC.prototype, "onCameraChanged", {
|
|
8816
|
-
get: function () {
|
|
8817
|
-
return Agora.onCameraChanged;
|
|
8818
|
-
},
|
|
8819
|
-
set: function (value) {
|
|
8820
|
-
Agora.onCameraChanged = value;
|
|
8821
|
-
},
|
|
8822
|
-
enumerable: false,
|
|
8823
|
-
configurable: true
|
|
8824
|
-
});
|
|
8825
|
-
Object.defineProperty(AgoraRTC.prototype, "onMicrophoneChanged", {
|
|
8826
|
-
get: function () {
|
|
8827
|
-
return Agora.onMicrophoneChanged;
|
|
8828
|
-
},
|
|
8829
|
-
set: function (value) {
|
|
8830
|
-
Agora.onMicrophoneChanged = value;
|
|
8831
|
-
},
|
|
8832
|
-
enumerable: false,
|
|
8833
|
-
configurable: true
|
|
8834
|
-
});
|
|
8835
|
-
Object.defineProperty(AgoraRTC.prototype, "onPlaybackDeviceChanged", {
|
|
8836
|
-
get: function () {
|
|
8837
|
-
return Agora.onPlaybackDeviceChanged;
|
|
8838
|
-
},
|
|
8839
|
-
set: function (value) {
|
|
8840
|
-
Agora.onPlaybackDeviceChanged = value;
|
|
8841
|
-
},
|
|
8842
|
-
enumerable: false,
|
|
8843
|
-
configurable: true
|
|
8844
|
-
});
|
|
8845
|
-
Object.defineProperty(AgoraRTC.prototype, "onAudioAutoplayFailed", {
|
|
8846
|
-
get: function () {
|
|
8847
|
-
return Agora.onAudioAutoplayFailed;
|
|
8848
|
-
},
|
|
8849
|
-
set: function (value) {
|
|
8850
|
-
Agora.onAudioAutoplayFailed = value;
|
|
8851
|
-
},
|
|
8852
|
-
enumerable: false,
|
|
8853
|
-
configurable: true
|
|
8854
|
-
});
|
|
8855
|
-
Object.defineProperty(AgoraRTC.prototype, "onAutoplayFailed", {
|
|
8856
|
-
get: function () {
|
|
8857
|
-
return Agora.onAutoplayFailed;
|
|
8858
|
-
},
|
|
8859
|
-
set: function (value) {
|
|
8860
|
-
Agora.onAutoplayFailed = value;
|
|
8861
|
-
},
|
|
8862
|
-
enumerable: false,
|
|
8863
|
-
configurable: true
|
|
8864
|
-
});
|
|
8865
|
-
AgoraRTC.prototype.setArea = function (area) {
|
|
8866
|
-
return Agora.setArea(area);
|
|
8867
|
-
};
|
|
8868
|
-
AgoraRTC.prototype.processExternalMediaAEC = function (element) {
|
|
8869
|
-
return Agora.processExternalMediaAEC(element);
|
|
8870
|
-
};
|
|
8871
|
-
return AgoraRTC;
|
|
8872
|
-
}());
|
|
8827
|
+
return Client;
|
|
8828
|
+
}(Emitter));
|
|
8829
|
+
var parseAgoraUserId = function (userId, flag) {
|
|
8830
|
+
return userId ^ codeMap[flag];
|
|
8831
|
+
};
|
|
8832
|
+
var streamFlagMap = ['main', 'sub', 'system'];
|
|
8833
|
+
var codeMap = {
|
|
8834
|
+
main: 0x0,
|
|
8835
|
+
sub: 0x40000000,
|
|
8836
|
+
system: 0x80000000,
|
|
8837
|
+
};
|
|
8873
8838
|
|
|
8874
8839
|
var CoreRTC$1 = /** @class */ (function () {
|
|
8875
8840
|
function CoreRTC(_a) {
|
|
@@ -8891,6 +8856,7 @@ var CoreRTC$1 = /** @class */ (function () {
|
|
|
8891
8856
|
token: this._token,
|
|
8892
8857
|
plan: this._plan,
|
|
8893
8858
|
type: RTCEngineType.Core,
|
|
8859
|
+
prefix: config.streamPrefix,
|
|
8894
8860
|
});
|
|
8895
8861
|
};
|
|
8896
8862
|
CoreRTC.prototype.createBufferSourceAudioTrack = function (config) {
|
|
@@ -9472,7 +9438,7 @@ function log(clsName) {
|
|
|
9472
9438
|
sdk_api_name: '中间层-函数调用',
|
|
9473
9439
|
message: "\u4E2D\u95F4\u5C42-" + clsName + "." + name,
|
|
9474
9440
|
from_encapsulation_layer: true,
|
|
9475
|
-
encapsulation_layer_built_timestamp: '2025/
|
|
9441
|
+
encapsulation_layer_built_timestamp: '2025/5/15 17:28:06',
|
|
9476
9442
|
});
|
|
9477
9443
|
}
|
|
9478
9444
|
}
|
|
@@ -11242,7 +11208,7 @@ var VolcVideoPlayer = /** @class */ (function (_super) {
|
|
|
11242
11208
|
};
|
|
11243
11209
|
// 播放视频
|
|
11244
11210
|
VolcVideoPlayer.prototype.playVideo = function (mediaStreamTrack) {
|
|
11245
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
11211
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
11246
11212
|
var vDom, ms;
|
|
11247
11213
|
var _this = this;
|
|
11248
11214
|
return __generator(this, function (_a) {
|
|
@@ -11628,7 +11594,7 @@ var AudioLevelFetcher = /** @class */ (function () {
|
|
|
11628
11594
|
};
|
|
11629
11595
|
AudioLevelFetcher.prototype.resume = function () {
|
|
11630
11596
|
var _a;
|
|
11631
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
11597
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
11632
11598
|
return __generator(this, function (_b) {
|
|
11633
11599
|
switch (_b.label) {
|
|
11634
11600
|
case 0: return [4 /*yield*/, ((_a = this._ctx) === null || _a === void 0 ? void 0 : _a.resume().catch(function (e) {
|
|
@@ -11852,7 +11818,7 @@ var VolcAudioPlayer = /** @class */ (function (_super) {
|
|
|
11852
11818
|
// 插入promise
|
|
11853
11819
|
ret = ret.then(function () {
|
|
11854
11820
|
return new Promise(function (resolve) {
|
|
11855
|
-
setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
11821
|
+
setTimeout(function () { return __awaiter$2(_this, void 0, void 0, function () {
|
|
11856
11822
|
var _a;
|
|
11857
11823
|
return __generator(this, function (_b) {
|
|
11858
11824
|
switch (_b.label) {
|
|
@@ -11969,7 +11935,7 @@ var VolcAudioPlayer = /** @class */ (function (_super) {
|
|
|
11969
11935
|
// rawRTCMediaStreamTrack RTC 收到的 原始 mediaStreamTrack
|
|
11970
11936
|
// mediaStreamTrack 经过 Web Audio 放大的 mediaStreamTrack
|
|
11971
11937
|
VolcAudioPlayer.prototype.playAudio = function (mediaStreamTrack, rawRTCMediaStreamTrack) {
|
|
11972
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
11938
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
11973
11939
|
var aDom, ms;
|
|
11974
11940
|
var _this = this;
|
|
11975
11941
|
return __generator(this, function (_a) {
|
|
@@ -12096,12 +12062,15 @@ var VolcAudioPlayer = /** @class */ (function (_super) {
|
|
|
12096
12062
|
});
|
|
12097
12063
|
};
|
|
12098
12064
|
VolcAudioPlayer.prototype.setPlaybackDevice = function (deviceId) {
|
|
12099
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12065
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12100
12066
|
var devices, audioDeviceIds;
|
|
12101
12067
|
return __generator(this, function (_a) {
|
|
12102
12068
|
switch (_a.label) {
|
|
12103
12069
|
case 0:
|
|
12104
12070
|
printLocal('setPlaybackDevice', "setPlaybackDevice: " + deviceId);
|
|
12071
|
+
if (!deviceId) {
|
|
12072
|
+
return [2 /*return*/];
|
|
12073
|
+
}
|
|
12105
12074
|
return [4 /*yield*/, VERTC.enumerateAudioPlaybackDevices()];
|
|
12106
12075
|
case 1:
|
|
12107
12076
|
devices = _a.sent();
|
|
@@ -12448,7 +12417,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12448
12417
|
this._stopPublishingWhenTrackEnded();
|
|
12449
12418
|
};
|
|
12450
12419
|
VolcLocalTrack.prototype._trackMuteHandler = function () {
|
|
12451
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12420
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12452
12421
|
return __generator(this, function (_a) {
|
|
12453
12422
|
switch (_a.label) {
|
|
12454
12423
|
case 0:
|
|
@@ -12518,7 +12487,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12518
12487
|
};
|
|
12519
12488
|
VolcLocalTrack.prototype._startCapturing = function () {
|
|
12520
12489
|
var _a, _b, _c, _d;
|
|
12521
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12490
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12522
12491
|
return __generator(this, function (_e) {
|
|
12523
12492
|
switch (_e.label) {
|
|
12524
12493
|
case 0:
|
|
@@ -12554,7 +12523,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12554
12523
|
};
|
|
12555
12524
|
VolcLocalTrack.prototype._stopCapturing = function () {
|
|
12556
12525
|
var _a, _b, _c, _d;
|
|
12557
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12526
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12558
12527
|
return __generator(this, function (_e) {
|
|
12559
12528
|
switch (_e.label) {
|
|
12560
12529
|
case 0:
|
|
@@ -12582,7 +12551,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12582
12551
|
};
|
|
12583
12552
|
VolcLocalTrack.prototype._startScreenCapturing = function () {
|
|
12584
12553
|
var _a, _b, _c, _d;
|
|
12585
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12554
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12586
12555
|
return __generator(this, function (_e) {
|
|
12587
12556
|
switch (_e.label) {
|
|
12588
12557
|
case 0:
|
|
@@ -12622,7 +12591,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12622
12591
|
};
|
|
12623
12592
|
VolcLocalTrack.prototype._stopScreenCapturing = function () {
|
|
12624
12593
|
var _a, _b;
|
|
12625
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12594
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12626
12595
|
return __generator(this, function (_c) {
|
|
12627
12596
|
switch (_c.label) {
|
|
12628
12597
|
case 0:
|
|
@@ -12639,7 +12608,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12639
12608
|
};
|
|
12640
12609
|
VolcLocalTrack.prototype.setEnabled = function (enabled) {
|
|
12641
12610
|
var _a;
|
|
12642
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12611
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12643
12612
|
var msg;
|
|
12644
12613
|
return __generator(this, function (_b) {
|
|
12645
12614
|
switch (_b.label) {
|
|
@@ -12658,7 +12627,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12658
12627
|
});
|
|
12659
12628
|
};
|
|
12660
12629
|
VolcLocalTrack.prototype._checkStatus = function () {
|
|
12661
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12630
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12662
12631
|
return __generator(this, function (_a) {
|
|
12663
12632
|
if (this.isScreen) {
|
|
12664
12633
|
return [2 /*return*/, this._checkStatusForScreen()];
|
|
@@ -12671,7 +12640,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12671
12640
|
};
|
|
12672
12641
|
VolcLocalTrack.prototype._checkStatusForMain = function () {
|
|
12673
12642
|
var _a, _b;
|
|
12674
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12643
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12675
12644
|
var mediaType;
|
|
12676
12645
|
return __generator(this, function (_c) {
|
|
12677
12646
|
switch (_c.label) {
|
|
@@ -12710,7 +12679,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12710
12679
|
};
|
|
12711
12680
|
VolcLocalTrack.prototype._stopPublishingWhenTrackEnded = function () {
|
|
12712
12681
|
var _a, _b;
|
|
12713
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12682
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12714
12683
|
var mediaType;
|
|
12715
12684
|
return __generator(this, function (_c) {
|
|
12716
12685
|
switch (_c.label) {
|
|
@@ -12746,7 +12715,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12746
12715
|
VolcLocalTrack.prototype._refreshPlayAfterTrackUpdated = function () { };
|
|
12747
12716
|
VolcLocalTrack.prototype._checkStatusForScreen = function () {
|
|
12748
12717
|
var _a, _b;
|
|
12749
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12718
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12750
12719
|
var mediaType;
|
|
12751
12720
|
return __generator(this, function (_c) {
|
|
12752
12721
|
switch (_c.label) {
|
|
@@ -12785,7 +12754,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12785
12754
|
};
|
|
12786
12755
|
VolcLocalTrack.prototype.setMuted = function (muted) {
|
|
12787
12756
|
var _a;
|
|
12788
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12757
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12789
12758
|
var msg;
|
|
12790
12759
|
return __generator(this, function (_b) {
|
|
12791
12760
|
switch (_b.label) {
|
|
@@ -12834,7 +12803,7 @@ var VolcLocalTrack = /** @class */ (function (_super) {
|
|
|
12834
12803
|
// getStats(): LocalVideoTrackStats | LocalAudioTrackStats {}
|
|
12835
12804
|
VolcLocalTrack.prototype.close = function () {
|
|
12836
12805
|
var _a, _b, _c, _d, _e, _f;
|
|
12837
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12806
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
12838
12807
|
var _g, _h, _j;
|
|
12839
12808
|
return __generator(this, function (_k) {
|
|
12840
12809
|
switch (_k.label) {
|
|
@@ -13234,7 +13203,7 @@ var VolcCameraVideoTrack = /** @class */ (function (_super) {
|
|
|
13234
13203
|
}
|
|
13235
13204
|
VolcCameraVideoTrack.prototype.setDevice = function (deviceId) {
|
|
13236
13205
|
var _a, _b, _c, _d;
|
|
13237
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
13206
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
13238
13207
|
var needResumePlay;
|
|
13239
13208
|
return __generator(this, function (_e) {
|
|
13240
13209
|
switch (_e.label) {
|
|
@@ -13274,7 +13243,7 @@ var VolcCameraVideoTrack = /** @class */ (function (_super) {
|
|
|
13274
13243
|
});
|
|
13275
13244
|
};
|
|
13276
13245
|
VolcCameraVideoTrack.prototype.setEncoderConfiguration = function (config) {
|
|
13277
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
13246
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
13278
13247
|
var videoEncoderConfig;
|
|
13279
13248
|
return __generator(this, function (_a) {
|
|
13280
13249
|
switch (_a.label) {
|
|
@@ -13406,6 +13375,7 @@ var VolcLocalAudioTrack = /** @class */ (function (_super) {
|
|
|
13406
13375
|
};
|
|
13407
13376
|
// 获取本地音频轨道的音量等级。返回音量等级值,范围 [0, 1],1 代表理论最大音量。
|
|
13408
13377
|
// https://rtcdocs.magic-school.com/api/web/classes/track_LocalAudioTrack.LocalAudioTrack.html#getvolumelevel
|
|
13378
|
+
// @log('VolcLocalAudioTrack')
|
|
13409
13379
|
VolcLocalAudioTrack.prototype.getVolumeLevel = function () {
|
|
13410
13380
|
// htmlMediaElement 元素音量等级
|
|
13411
13381
|
// return this._domElement ? this._domElement.volume : 0;
|
|
@@ -13447,7 +13417,7 @@ var VolcLocalAudioTrack = /** @class */ (function (_super) {
|
|
|
13447
13417
|
}
|
|
13448
13418
|
};
|
|
13449
13419
|
VolcLocalAudioTrack.prototype.setPlaybackDevice = function (deviceId) {
|
|
13450
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
13420
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
13451
13421
|
var monitor;
|
|
13452
13422
|
return __generator(this, function (_a) {
|
|
13453
13423
|
switch (_a.label) {
|
|
@@ -13493,9 +13463,6 @@ var VolcLocalAudioTrack = /** @class */ (function (_super) {
|
|
|
13493
13463
|
__decorate([
|
|
13494
13464
|
log('VolcLocalAudioTrack')
|
|
13495
13465
|
], VolcLocalAudioTrack.prototype, "setVolume", null);
|
|
13496
|
-
__decorate([
|
|
13497
|
-
log('VolcLocalAudioTrack')
|
|
13498
|
-
], VolcLocalAudioTrack.prototype, "getVolumeLevel", null);
|
|
13499
13466
|
__decorate([
|
|
13500
13467
|
log('VolcLocalAudioTrack')
|
|
13501
13468
|
], VolcLocalAudioTrack.prototype, "play", null);
|
|
@@ -13527,7 +13494,7 @@ var VolcMicrophoneAudioTrack = /** @class */ (function (_super) {
|
|
|
13527
13494
|
return _this;
|
|
13528
13495
|
}
|
|
13529
13496
|
VolcMicrophoneAudioTrack.prototype.setDevice = function (deviceId) {
|
|
13530
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
13497
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
13531
13498
|
return __generator(this, function (_a) {
|
|
13532
13499
|
switch (_a.label) {
|
|
13533
13500
|
case 0:
|
|
@@ -13669,6 +13636,7 @@ var VolcRemoteAudioTrack = /** @class */ (function (_super) {
|
|
|
13669
13636
|
};
|
|
13670
13637
|
// 获取远端音频轨道的音量等级。返回音量等级值,范围 [0, 1],1 代表理论最大音量。
|
|
13671
13638
|
// https://rtcdocs.magic-school.com/api/web/classes/track_RemoteAudioTrack.RemoteAudioTrack.html#getvolumelevel
|
|
13639
|
+
// @log('VolcRemoteAudioTrack')
|
|
13672
13640
|
VolcRemoteAudioTrack.prototype.getVolumeLevel = function () {
|
|
13673
13641
|
// htmlMediaElement 元素音量等级
|
|
13674
13642
|
// return this._domElement ? this._domElement.volume : 0;
|
|
@@ -13693,7 +13661,7 @@ var VolcRemoteAudioTrack = /** @class */ (function (_super) {
|
|
|
13693
13661
|
this._volumeLevel = val;
|
|
13694
13662
|
};
|
|
13695
13663
|
VolcRemoteAudioTrack.prototype.setPlaybackDevice = function (deviceId) {
|
|
13696
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
13664
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
13697
13665
|
var monitor;
|
|
13698
13666
|
return __generator(this, function (_a) {
|
|
13699
13667
|
switch (_a.label) {
|
|
@@ -13784,9 +13752,6 @@ var VolcRemoteAudioTrack = /** @class */ (function (_super) {
|
|
|
13784
13752
|
__decorate([
|
|
13785
13753
|
log('VolcRemoteAudioTrack')
|
|
13786
13754
|
], VolcRemoteAudioTrack.prototype, "_playerEventHandler", null);
|
|
13787
|
-
__decorate([
|
|
13788
|
-
log('VolcRemoteAudioTrack')
|
|
13789
|
-
], VolcRemoteAudioTrack.prototype, "getVolumeLevel", null);
|
|
13790
13755
|
__decorate([
|
|
13791
13756
|
log('VolcRemoteAudioTrack')
|
|
13792
13757
|
], VolcRemoteAudioTrack.prototype, "setVolumeLevel", null);
|
|
@@ -14051,7 +14016,7 @@ var RTCRemoteUser = /** @class */ (function () {
|
|
|
14051
14016
|
return RTCRemoteUser;
|
|
14052
14017
|
}());
|
|
14053
14018
|
|
|
14054
|
-
var handleVideoTrackInitConfig = function (engine, config, forPublish, cameraVideoTrack) { return __awaiter(void 0, void 0, void 0, function () {
|
|
14019
|
+
var handleVideoTrackInitConfig = function (engine, config, forPublish, cameraVideoTrack) { return __awaiter$2(void 0, void 0, void 0, function () {
|
|
14055
14020
|
var videoEncoderConfig;
|
|
14056
14021
|
return __generator(this, function (_a) {
|
|
14057
14022
|
switch (_a.label) {
|
|
@@ -14097,7 +14062,7 @@ var handleVideoTrackInitConfig = function (engine, config, forPublish, cameraVid
|
|
|
14097
14062
|
}
|
|
14098
14063
|
});
|
|
14099
14064
|
}); };
|
|
14100
|
-
var handleAudioTrackInitConfig = function (engine, config, forPublish) { return __awaiter(void 0, void 0, void 0, function () {
|
|
14065
|
+
var handleAudioTrackInitConfig = function (engine, config, forPublish) { return __awaiter$2(void 0, void 0, void 0, function () {
|
|
14101
14066
|
var mediaTrackConstraints, audioEncodeConfig;
|
|
14102
14067
|
return __generator(this, function (_a) {
|
|
14103
14068
|
switch (_a.label) {
|
|
@@ -14149,7 +14114,7 @@ var handleAudioTrackInitConfig = function (engine, config, forPublish) { return
|
|
|
14149
14114
|
}
|
|
14150
14115
|
});
|
|
14151
14116
|
}); };
|
|
14152
|
-
var handleScreenVideoTrackInitConfig = function (engine, config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
14117
|
+
var handleScreenVideoTrackInitConfig = function (engine, config) { return __awaiter$2(void 0, void 0, void 0, function () {
|
|
14153
14118
|
var screenVideoEncoderConfig;
|
|
14154
14119
|
return __generator(this, function (_a) {
|
|
14155
14120
|
switch (_a.label) {
|
|
@@ -14168,7 +14133,7 @@ var handleScreenVideoTrackInitConfig = function (engine, config) { return __awai
|
|
|
14168
14133
|
}
|
|
14169
14134
|
});
|
|
14170
14135
|
}); };
|
|
14171
|
-
var handleExternalVideoTrackInitConfig = function (engine, config, applyForPublish) { return __awaiter(void 0, void 0, void 0, function () {
|
|
14136
|
+
var handleExternalVideoTrackInitConfig = function (engine, config, applyForPublish) { return __awaiter$2(void 0, void 0, void 0, function () {
|
|
14172
14137
|
var mediaStreamTrack, currSettings, externalVideoEncoderConfig;
|
|
14173
14138
|
return __generator(this, function (_a) {
|
|
14174
14139
|
switch (_a.label) {
|
|
@@ -14201,7 +14166,7 @@ var handleExternalVideoTrackInitConfig = function (engine, config, applyForPubli
|
|
|
14201
14166
|
}
|
|
14202
14167
|
});
|
|
14203
14168
|
}); };
|
|
14204
|
-
var handleExternalScreenVideoTrackInitConfig = function (engine, config, applyForPublish) { return __awaiter(void 0, void 0, void 0, function () {
|
|
14169
|
+
var handleExternalScreenVideoTrackInitConfig = function (engine, config, applyForPublish) { return __awaiter$2(void 0, void 0, void 0, function () {
|
|
14205
14170
|
var mediaStreamTrack, currSettings, externalVideoEncoderConfig;
|
|
14206
14171
|
return __generator(this, function (_a) {
|
|
14207
14172
|
switch (_a.label) {
|
|
@@ -14233,7 +14198,7 @@ var handleExternalScreenVideoTrackInitConfig = function (engine, config, applyFo
|
|
|
14233
14198
|
}
|
|
14234
14199
|
});
|
|
14235
14200
|
}); };
|
|
14236
|
-
var handleExternalAudioTrackInitConfig = function (engine, config, applyForPublish) { return __awaiter(void 0, void 0, void 0, function () {
|
|
14201
|
+
var handleExternalAudioTrackInitConfig = function (engine, config, applyForPublish) { return __awaiter$2(void 0, void 0, void 0, function () {
|
|
14237
14202
|
var audioEncodeConfig, mediaTrackConstraints;
|
|
14238
14203
|
return __generator(this, function (_a) {
|
|
14239
14204
|
switch (_a.label) {
|
|
@@ -14260,7 +14225,7 @@ var handleExternalAudioTrackInitConfig = function (engine, config, applyForPubli
|
|
|
14260
14225
|
});
|
|
14261
14226
|
}); };
|
|
14262
14227
|
// screen-audio 和 audio external track 编码控制没有区别
|
|
14263
|
-
var handleExternalScreenAudioTrackInitConfig = function (engine, config, applyForPublish) { return __awaiter(void 0, void 0, void 0, function () {
|
|
14228
|
+
var handleExternalScreenAudioTrackInitConfig = function (engine, config, applyForPublish) { return __awaiter$2(void 0, void 0, void 0, function () {
|
|
14264
14229
|
var audioEncodeConfig, mediaTrackConstraints;
|
|
14265
14230
|
return __generator(this, function (_a) {
|
|
14266
14231
|
switch (_a.label) {
|
|
@@ -14562,11 +14527,11 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14562
14527
|
var remoteUser = this._remoteUserMap[userId];
|
|
14563
14528
|
if (hasPublishVideo) {
|
|
14564
14529
|
remoteUser.hasVideo = true;
|
|
14565
|
-
this.emit('user-published', remoteUser, 'video');
|
|
14530
|
+
this.emit('user-published', remoteUser, 'video', 'main');
|
|
14566
14531
|
}
|
|
14567
14532
|
if (hasPublishAudio) {
|
|
14568
14533
|
remoteUser.hasAudio = true;
|
|
14569
|
-
this.emit('user-published', remoteUser, 'audio');
|
|
14534
|
+
this.emit('user-published', remoteUser, 'audio', 'main');
|
|
14570
14535
|
}
|
|
14571
14536
|
};
|
|
14572
14537
|
VolcClient.prototype._onUserPublishScreenHandler = function (e) {
|
|
@@ -14579,7 +14544,11 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14579
14544
|
var remoteUser = this._remoteUserMap[userId];
|
|
14580
14545
|
if (hasPublishVideo) {
|
|
14581
14546
|
remoteUser.hasScreen = true;
|
|
14582
|
-
this.emit('user-published', remoteUser, '
|
|
14547
|
+
this.emit('user-published', remoteUser, 'video', 'sub');
|
|
14548
|
+
}
|
|
14549
|
+
if (hasPublishAudio) {
|
|
14550
|
+
// 本期暂不支持屏幕共享音频, 所以不做处理
|
|
14551
|
+
this.emit('user-published', remoteUser, 'audio', 'sub');
|
|
14583
14552
|
}
|
|
14584
14553
|
};
|
|
14585
14554
|
VolcClient.prototype._onUserUnpublishStreamHandler = function (e) {
|
|
@@ -14592,11 +14561,11 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14592
14561
|
var remoteUser = this._remoteUserMap[userId];
|
|
14593
14562
|
if (hasUnpublishAudio) {
|
|
14594
14563
|
remoteUser.hasAudio = false;
|
|
14595
|
-
this.emit('user-unpublished', remoteUser, 'audio');
|
|
14564
|
+
this.emit('user-unpublished', remoteUser, 'audio', 'main');
|
|
14596
14565
|
}
|
|
14597
14566
|
if (hasUnpublishVideo) {
|
|
14598
14567
|
remoteUser.hasVideo = false;
|
|
14599
|
-
this.emit('user-unpublished', remoteUser, 'video');
|
|
14568
|
+
this.emit('user-unpublished', remoteUser, 'video', 'main');
|
|
14600
14569
|
}
|
|
14601
14570
|
};
|
|
14602
14571
|
VolcClient.prototype._onUserUnpublishScreenHandler = function (e) {
|
|
@@ -14609,7 +14578,11 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14609
14578
|
var remoteUser = this._remoteUserMap[userId];
|
|
14610
14579
|
if (hasUnpublishVideo) {
|
|
14611
14580
|
remoteUser.hasScreen = false;
|
|
14612
|
-
this.emit('user-unpublished', remoteUser, '
|
|
14581
|
+
this.emit('user-unpublished', remoteUser, 'video', 'sub');
|
|
14582
|
+
}
|
|
14583
|
+
if (hasUnpublishAudio) {
|
|
14584
|
+
// 本期暂不支持屏幕共享音频, 所以不做处理
|
|
14585
|
+
this.emit('user-unpublished', remoteUser, 'audio', 'sub');
|
|
14613
14586
|
}
|
|
14614
14587
|
};
|
|
14615
14588
|
VolcClient.prototype._onError = function (e) {
|
|
@@ -14662,7 +14635,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14662
14635
|
// on(event: string, listener: Function): void;
|
|
14663
14636
|
// P0
|
|
14664
14637
|
VolcClient.prototype.join = function () {
|
|
14665
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14638
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14666
14639
|
var _this_1 = this;
|
|
14667
14640
|
return __generator(this, function (_a) {
|
|
14668
14641
|
recoverVolcUsedAPIs();
|
|
@@ -14715,7 +14688,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14715
14688
|
};
|
|
14716
14689
|
// P0
|
|
14717
14690
|
VolcClient.prototype.leave = function () {
|
|
14718
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14691
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14719
14692
|
var _this_1 = this;
|
|
14720
14693
|
return __generator(this, function (_a) {
|
|
14721
14694
|
volcCommonStatus.hasJoinRoom = false;
|
|
@@ -14738,7 +14711,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14738
14711
|
});
|
|
14739
14712
|
};
|
|
14740
14713
|
VolcClient.prototype._prepareForPublishCameraVideo = function (cameraVideoTrack) {
|
|
14741
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14714
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14742
14715
|
return __generator(this, function (_a) {
|
|
14743
14716
|
switch (_a.label) {
|
|
14744
14717
|
case 0:
|
|
@@ -14754,7 +14727,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14754
14727
|
});
|
|
14755
14728
|
};
|
|
14756
14729
|
VolcClient.prototype._prepareForPublishMicrophoneAudio = function (microphoneAudioTrack) {
|
|
14757
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14730
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14758
14731
|
return __generator(this, function (_a) {
|
|
14759
14732
|
switch (_a.label) {
|
|
14760
14733
|
case 0:
|
|
@@ -14773,7 +14746,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14773
14746
|
});
|
|
14774
14747
|
};
|
|
14775
14748
|
VolcClient.prototype._prepareForPublishScreenVideo = function (screenVideoTrack) {
|
|
14776
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14749
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14777
14750
|
return __generator(this, function (_a) {
|
|
14778
14751
|
switch (_a.label) {
|
|
14779
14752
|
case 0:
|
|
@@ -14793,7 +14766,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14793
14766
|
});
|
|
14794
14767
|
};
|
|
14795
14768
|
VolcClient.prototype._prepareForPublishScreenAudio = function (screenAudioTrack) {
|
|
14796
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14769
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14797
14770
|
return __generator(this, function (_a) {
|
|
14798
14771
|
switch (_a.label) {
|
|
14799
14772
|
case 0:
|
|
@@ -14808,7 +14781,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14808
14781
|
});
|
|
14809
14782
|
};
|
|
14810
14783
|
VolcClient.prototype._prepareForPublishExternalVideo = function (externalVideo) {
|
|
14811
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14784
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14812
14785
|
return __generator(this, function (_a) {
|
|
14813
14786
|
switch (_a.label) {
|
|
14814
14787
|
case 0:
|
|
@@ -14830,7 +14803,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14830
14803
|
});
|
|
14831
14804
|
};
|
|
14832
14805
|
VolcClient.prototype._prepareForPublishExternalAudio = function (externalAudio) {
|
|
14833
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14806
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14834
14807
|
return __generator(this, function (_a) {
|
|
14835
14808
|
switch (_a.label) {
|
|
14836
14809
|
case 0:
|
|
@@ -14852,7 +14825,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14852
14825
|
});
|
|
14853
14826
|
};
|
|
14854
14827
|
VolcClient.prototype._prepareForPublishExternalScreenVideo = function (externalScreenVideo) {
|
|
14855
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14828
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14856
14829
|
return __generator(this, function (_a) {
|
|
14857
14830
|
switch (_a.label) {
|
|
14858
14831
|
case 0:
|
|
@@ -14875,7 +14848,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14875
14848
|
});
|
|
14876
14849
|
};
|
|
14877
14850
|
VolcClient.prototype._prepareForPublishExternalScreenAudio = function (externalScreenAudio) {
|
|
14878
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14851
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14879
14852
|
return __generator(this, function (_a) {
|
|
14880
14853
|
switch (_a.label) {
|
|
14881
14854
|
case 0:
|
|
@@ -14898,7 +14871,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14898
14871
|
});
|
|
14899
14872
|
};
|
|
14900
14873
|
VolcClient.prototype._prepareForUnPublishCameraVideo = function () {
|
|
14901
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14874
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14902
14875
|
return __generator(this, function (_a) {
|
|
14903
14876
|
switch (_a.label) {
|
|
14904
14877
|
case 0:
|
|
@@ -14912,7 +14885,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14912
14885
|
});
|
|
14913
14886
|
};
|
|
14914
14887
|
VolcClient.prototype._prepareForUnPublishMicrophoneAudio = function () {
|
|
14915
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14888
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14916
14889
|
return __generator(this, function (_a) {
|
|
14917
14890
|
switch (_a.label) {
|
|
14918
14891
|
case 0:
|
|
@@ -14926,7 +14899,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14926
14899
|
});
|
|
14927
14900
|
};
|
|
14928
14901
|
VolcClient.prototype._prepareForUnPublishScreenVideo = function () {
|
|
14929
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14902
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14930
14903
|
return __generator(this, function (_a) {
|
|
14931
14904
|
switch (_a.label) {
|
|
14932
14905
|
case 0:
|
|
@@ -14941,7 +14914,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14941
14914
|
});
|
|
14942
14915
|
};
|
|
14943
14916
|
VolcClient.prototype._prepareForUnPublishScreenAudio = function () {
|
|
14944
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14917
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14945
14918
|
return __generator(this, function (_a) {
|
|
14946
14919
|
switch (_a.label) {
|
|
14947
14920
|
case 0:
|
|
@@ -14956,7 +14929,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14956
14929
|
});
|
|
14957
14930
|
};
|
|
14958
14931
|
VolcClient.prototype._prepareForUnPublishExternalVideo = function () {
|
|
14959
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14932
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14960
14933
|
return __generator(this, function (_a) {
|
|
14961
14934
|
switch (_a.label) {
|
|
14962
14935
|
case 0:
|
|
@@ -14970,7 +14943,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14970
14943
|
});
|
|
14971
14944
|
};
|
|
14972
14945
|
VolcClient.prototype._prepareForUnPublishExternalAudio = function () {
|
|
14973
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14946
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14974
14947
|
return __generator(this, function (_a) {
|
|
14975
14948
|
switch (_a.label) {
|
|
14976
14949
|
case 0:
|
|
@@ -14984,7 +14957,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14984
14957
|
});
|
|
14985
14958
|
};
|
|
14986
14959
|
VolcClient.prototype._prepareForUnPublishExternalScreenVideo = function () {
|
|
14987
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14960
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
14988
14961
|
return __generator(this, function (_a) {
|
|
14989
14962
|
switch (_a.label) {
|
|
14990
14963
|
case 0:
|
|
@@ -14999,7 +14972,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
14999
14972
|
});
|
|
15000
14973
|
};
|
|
15001
14974
|
VolcClient.prototype._prepareForUnPublishExternalScreenAudio = function () {
|
|
15002
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14975
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15003
14976
|
return __generator(this, function (_a) {
|
|
15004
14977
|
switch (_a.label) {
|
|
15005
14978
|
case 0:
|
|
@@ -15015,7 +14988,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15015
14988
|
};
|
|
15016
14989
|
// P0
|
|
15017
14990
|
VolcClient.prototype.publish = function (tracks) {
|
|
15018
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14991
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15019
14992
|
var trackList, includeVideo, includeAudio, includeScreenVideo, includeScreenAudio, includeVideoExternal, includeAudioExternal, includeScreenVideoExternal, includeScreenAudioExternal, shouldPublishVideo, shouldPublishAudio, shouldPublishScreenVideo, shouldPublishScreenAudio, shouldPublishExternalVideo, shouldPublishExternalAudio, shouldPublishExternalScreenVideo, shouldPublishExternalScreenAudio, mediaType, mediaTypeForScreen, mediaTypeExternal, mediaTypeForScreenExternal;
|
|
15020
14993
|
return __generator(this, function (_a) {
|
|
15021
14994
|
switch (_a.label) {
|
|
@@ -15225,7 +15198,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15225
15198
|
* @returns
|
|
15226
15199
|
*/
|
|
15227
15200
|
VolcClient.prototype.unpublish = function (tracks) {
|
|
15228
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15201
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15229
15202
|
var prevPublishedTrack, trackList, includeVideo, includeAudio, includeScreenVideo, includeScreenAudio, includeVideoExternal, includeAudioExternal, includeScreenVideoExternal, includeScreenAudioExternal, mediaType, mediaTypeForScreen, mediaTypeExternal, mediaTypeForScreenExternal;
|
|
15230
15203
|
var _this_1 = this;
|
|
15231
15204
|
return __generator(this, function (_a) {
|
|
@@ -15388,8 +15361,8 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15388
15361
|
});
|
|
15389
15362
|
});
|
|
15390
15363
|
};
|
|
15391
|
-
VolcClient.prototype.subscribe = function (user, mediaType) {
|
|
15392
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15364
|
+
VolcClient.prototype.subscribe = function (user, mediaType, flag) {
|
|
15365
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15393
15366
|
var mType, track;
|
|
15394
15367
|
return __generator(this, function (_a) {
|
|
15395
15368
|
switch (_a.label) {
|
|
@@ -15397,21 +15370,20 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15397
15370
|
mType = {
|
|
15398
15371
|
video: MediaType.VIDEO,
|
|
15399
15372
|
audio: MediaType.AUDIO,
|
|
15400
|
-
screen: MediaType.VIDEO,
|
|
15401
15373
|
}[mediaType];
|
|
15402
|
-
if (!(
|
|
15374
|
+
if (!(flag === 'main')) return [3 /*break*/, 2];
|
|
15403
15375
|
return [4 /*yield*/, this._engine.subscribeStream(String(user.uid), mType)];
|
|
15404
15376
|
case 1:
|
|
15405
15377
|
_a.sent();
|
|
15406
15378
|
return [3 /*break*/, 4];
|
|
15407
15379
|
case 2:
|
|
15408
|
-
if (!(
|
|
15380
|
+
if (!(flag === 'sub')) return [3 /*break*/, 4];
|
|
15409
15381
|
return [4 /*yield*/, this._engine.subscribeScreen(String(user.uid), mType)];
|
|
15410
15382
|
case 3:
|
|
15411
15383
|
_a.sent();
|
|
15412
15384
|
_a.label = 4;
|
|
15413
15385
|
case 4:
|
|
15414
|
-
if (mediaType === 'video') {
|
|
15386
|
+
if (mediaType === 'video' && flag === 'main') {
|
|
15415
15387
|
track = new VolcRemoteVideoTrack();
|
|
15416
15388
|
track.engine = this._engine;
|
|
15417
15389
|
track.track = this._engine.getRemoteStreamTrack(String(user.uid), StreamIndex.STREAM_INDEX_MAIN, 'video');
|
|
@@ -15419,7 +15391,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15419
15391
|
user.videoTrack = track;
|
|
15420
15392
|
this._stats.remoteVideo.startSubscribe(user);
|
|
15421
15393
|
}
|
|
15422
|
-
|
|
15394
|
+
if (mediaType === 'audio' && flag === 'main') {
|
|
15423
15395
|
track = new VolcRemoteAudioTrack();
|
|
15424
15396
|
track.engine = this._engine;
|
|
15425
15397
|
track.track = this._engine.getRemoteStreamTrack(String(user.uid), StreamIndex.STREAM_INDEX_MAIN, 'audio');
|
|
@@ -15427,7 +15399,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15427
15399
|
user.audioTrack = track;
|
|
15428
15400
|
this._stats.remoteAudio.startSubscribe(user);
|
|
15429
15401
|
}
|
|
15430
|
-
|
|
15402
|
+
if (mediaType === 'video' && flag === 'sub') {
|
|
15431
15403
|
track = new VolcRemoteVideoTrack();
|
|
15432
15404
|
track.engine = this._engine;
|
|
15433
15405
|
track.track = this._engine.getRemoteStreamTrack(String(user.uid), StreamIndex.STREAM_INDEX_SCREEN, 'video');
|
|
@@ -15435,6 +15407,14 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15435
15407
|
track.isScreen = true;
|
|
15436
15408
|
user.screenTrack = track;
|
|
15437
15409
|
}
|
|
15410
|
+
if (mediaType === 'audio' && flag === 'sub') {
|
|
15411
|
+
track = new VolcRemoteAudioTrack();
|
|
15412
|
+
track.engine = this._engine;
|
|
15413
|
+
track.track = this._engine.getRemoteStreamTrack(String(user.uid), StreamIndex.STREAM_INDEX_SCREEN, 'audio');
|
|
15414
|
+
track.setUserId(user.uid);
|
|
15415
|
+
track.isScreen = true;
|
|
15416
|
+
user.screenAudioTrack = track;
|
|
15417
|
+
}
|
|
15438
15418
|
return [2 /*return*/, track];
|
|
15439
15419
|
}
|
|
15440
15420
|
});
|
|
@@ -15451,13 +15431,13 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15451
15431
|
// error?: OmniRTCError;
|
|
15452
15432
|
// }[]>;
|
|
15453
15433
|
// P0
|
|
15454
|
-
VolcClient.prototype.unsubscribe = function (user, mediaType) {
|
|
15455
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15434
|
+
VolcClient.prototype.unsubscribe = function (user, mediaType, flag) {
|
|
15435
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15456
15436
|
var mType;
|
|
15457
15437
|
return __generator(this, function (_a) {
|
|
15458
15438
|
switch (_a.label) {
|
|
15459
15439
|
case 0:
|
|
15460
|
-
if (mediaType === 'video') {
|
|
15440
|
+
if (mediaType === 'video' && flag === 'main') {
|
|
15461
15441
|
mType = MediaType.VIDEO;
|
|
15462
15442
|
if (user.videoTrack) {
|
|
15463
15443
|
user.videoTrack.track = undefined;
|
|
@@ -15466,7 +15446,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15466
15446
|
this._stats.remoteVideo.stopSubscribe(user);
|
|
15467
15447
|
return [2 /*return*/, this._engine.unsubscribeStream(String(user.uid), mType)];
|
|
15468
15448
|
}
|
|
15469
|
-
if (mediaType === 'audio') {
|
|
15449
|
+
if (mediaType === 'audio' && flag === 'main') {
|
|
15470
15450
|
mType = MediaType.AUDIO;
|
|
15471
15451
|
if (user.audioTrack) {
|
|
15472
15452
|
user.audioTrack.track = undefined;
|
|
@@ -15475,7 +15455,7 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15475
15455
|
this._stats.remoteAudio.stopSubscribe(user);
|
|
15476
15456
|
return [2 /*return*/, this._engine.unsubscribeStream(String(user.uid), mType)];
|
|
15477
15457
|
}
|
|
15478
|
-
if (mediaType === '
|
|
15458
|
+
if (mediaType === 'video' && flag === 'sub') {
|
|
15479
15459
|
mType = MediaType.VIDEO;
|
|
15480
15460
|
if (user.screenTrack) {
|
|
15481
15461
|
user.screenTrack.track = undefined;
|
|
@@ -15483,7 +15463,15 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15483
15463
|
user.screenTrack = undefined;
|
|
15484
15464
|
return [2 /*return*/, this._engine.unsubscribeScreen(String(user.uid), mType)];
|
|
15485
15465
|
}
|
|
15486
|
-
if (
|
|
15466
|
+
if (mediaType === 'audio' && flag === 'sub') {
|
|
15467
|
+
mType = MediaType.AUDIO;
|
|
15468
|
+
if (user.screenAudioTrack) {
|
|
15469
|
+
user.screenAudioTrack.track = undefined;
|
|
15470
|
+
}
|
|
15471
|
+
user.screenAudioTrack = undefined;
|
|
15472
|
+
return [2 /*return*/, this._engine.unsubscribeScreen(String(user.uid), mType)];
|
|
15473
|
+
}
|
|
15474
|
+
if (!(!mediaType && flag === 'main')) return [3 /*break*/, 2];
|
|
15487
15475
|
mType = MediaType.AUDIO_AND_VIDEO;
|
|
15488
15476
|
if (user.videoTrack) {
|
|
15489
15477
|
user.videoTrack.track = undefined;
|
|
@@ -15498,11 +15486,23 @@ var VolcClient = /** @class */ (function (_super) {
|
|
|
15498
15486
|
return [4 /*yield*/, this._engine.unsubscribeStream(String(user.uid), mType)];
|
|
15499
15487
|
case 1:
|
|
15500
15488
|
_a.sent();
|
|
15501
|
-
|
|
15489
|
+
_a.label = 2;
|
|
15502
15490
|
case 2:
|
|
15491
|
+
if (!(!mediaType && flag === 'sub')) return [3 /*break*/, 4];
|
|
15492
|
+
mType = MediaType.AUDIO_AND_VIDEO;
|
|
15493
|
+
if (user.screenTrack) {
|
|
15494
|
+
user.screenTrack.track = undefined;
|
|
15495
|
+
}
|
|
15496
|
+
if (user.screenAudioTrack) {
|
|
15497
|
+
user.screenAudioTrack.track = undefined;
|
|
15498
|
+
}
|
|
15499
|
+
user.screenTrack = undefined;
|
|
15500
|
+
user.screenAudioTrack = undefined;
|
|
15501
|
+
return [4 /*yield*/, this._engine.unsubscribeScreen(String(user.uid), mType)];
|
|
15502
|
+
case 3:
|
|
15503
15503
|
_a.sent();
|
|
15504
|
-
_a.label =
|
|
15505
|
-
case
|
|
15504
|
+
_a.label = 4;
|
|
15505
|
+
case 4: return [2 /*return*/];
|
|
15506
15506
|
}
|
|
15507
15507
|
});
|
|
15508
15508
|
});
|
|
@@ -15872,7 +15872,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
15872
15872
|
// }
|
|
15873
15873
|
// P0
|
|
15874
15874
|
VolcCoreRTC.prototype.createCameraVideoTrack = function (config) {
|
|
15875
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15875
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15876
15876
|
var localVideoTrack, cameraVideoTrack;
|
|
15877
15877
|
return __generator(this, function (_a) {
|
|
15878
15878
|
switch (_a.label) {
|
|
@@ -15930,7 +15930,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
15930
15930
|
};
|
|
15931
15931
|
// P0
|
|
15932
15932
|
VolcCoreRTC.prototype.createMicrophoneAndCameraTracks = function (audioConfig, videoConfig) {
|
|
15933
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15933
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15934
15934
|
var localAudioTrack, localVideoTrack, microphoneAudioTrack, cameraVideoTrack;
|
|
15935
15935
|
return __generator(this, function (_a) {
|
|
15936
15936
|
switch (_a.label) {
|
|
@@ -15982,7 +15982,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
15982
15982
|
};
|
|
15983
15983
|
// P0
|
|
15984
15984
|
VolcCoreRTC.prototype.createMicrophoneAudioTrack = function (config) {
|
|
15985
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15985
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
15986
15986
|
var localAudioTrack, res;
|
|
15987
15987
|
return __generator(this, function (_a) {
|
|
15988
15988
|
switch (_a.label) {
|
|
@@ -16016,7 +16016,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
16016
16016
|
};
|
|
16017
16017
|
// P0
|
|
16018
16018
|
VolcCoreRTC.prototype.createScreenVideoTrack = function (config, withAudio) {
|
|
16019
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
16019
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
16020
16020
|
var localVideoTrack, localAudioTrack, screenVideoTrack, screenAudioTrack;
|
|
16021
16021
|
return __generator(this, function (_a) {
|
|
16022
16022
|
switch (_a.label) {
|
|
@@ -16055,7 +16055,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
16055
16055
|
};
|
|
16056
16056
|
// P0
|
|
16057
16057
|
VolcCoreRTC.prototype.getSupportedCodec = function () {
|
|
16058
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
16058
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
16059
16059
|
var videoCodecs, res;
|
|
16060
16060
|
return __generator(this, function (_a) {
|
|
16061
16061
|
switch (_a.label) {
|
|
@@ -16077,7 +16077,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
16077
16077
|
};
|
|
16078
16078
|
// P0, skipPermissionCheck 可以不考虑
|
|
16079
16079
|
VolcCoreRTC.prototype.getDevices = function (skipPermissionCheck) {
|
|
16080
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
16080
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
16081
16081
|
var devices;
|
|
16082
16082
|
return __generator(this, function (_a) {
|
|
16083
16083
|
switch (_a.label) {
|
|
@@ -16092,7 +16092,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
16092
16092
|
};
|
|
16093
16093
|
// P0, skipPermissionCheck 可以不考虑
|
|
16094
16094
|
VolcCoreRTC.prototype.getMicrophones = function (skipPermissionCheck) {
|
|
16095
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
16095
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
16096
16096
|
var devices, audioInputs;
|
|
16097
16097
|
return __generator(this, function (_a) {
|
|
16098
16098
|
switch (_a.label) {
|
|
@@ -16108,7 +16108,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
16108
16108
|
};
|
|
16109
16109
|
// P0, skipPermissionCheck 可以不考虑
|
|
16110
16110
|
VolcCoreRTC.prototype.getCameras = function (skipPermissionCheck) {
|
|
16111
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
16111
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
16112
16112
|
var devices, videoInputs;
|
|
16113
16113
|
return __generator(this, function (_a) {
|
|
16114
16114
|
switch (_a.label) {
|
|
@@ -16143,7 +16143,7 @@ var VolcCoreRTC = /** @class */ (function () {
|
|
|
16143
16143
|
};
|
|
16144
16144
|
// P0, skipPermissionCheck 可以不考虑
|
|
16145
16145
|
VolcCoreRTC.prototype.getPlaybackDevices = function (skipPermissionCheck) {
|
|
16146
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
16146
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
16147
16147
|
var devices, audioOutputs;
|
|
16148
16148
|
return __generator(this, function (_a) {
|
|
16149
16149
|
switch (_a.label) {
|
|
@@ -16383,6 +16383,7 @@ var VolcCoreRTCWrapper = /** @class */ (function () {
|
|
|
16383
16383
|
token: this._token,
|
|
16384
16384
|
plan: this._plan,
|
|
16385
16385
|
type: RTCEngineType.VolcEngine,
|
|
16386
|
+
prefix: config.streamPrefix,
|
|
16386
16387
|
});
|
|
16387
16388
|
};
|
|
16388
16389
|
// P1 下一期实现
|
|
@@ -16584,14 +16585,14 @@ function getRTCInstance(token, extraInfo) {
|
|
|
16584
16585
|
var data = lib(token);
|
|
16585
16586
|
console.log('token data: ', data);
|
|
16586
16587
|
switch (data.type) {
|
|
16587
|
-
case RTCEngineType.Agora:
|
|
16588
|
-
|
|
16589
|
-
|
|
16590
|
-
|
|
16591
|
-
|
|
16592
|
-
|
|
16593
|
-
|
|
16594
|
-
|
|
16588
|
+
// case RTCEngineType.Agora:
|
|
16589
|
+
// return new AgoraRTC({
|
|
16590
|
+
// appId: data.appid,
|
|
16591
|
+
// roomId: data.roomStr,
|
|
16592
|
+
// userId: data.user,
|
|
16593
|
+
// sdkToken: data.attachToken || data.token,
|
|
16594
|
+
// plan: data.planid,
|
|
16595
|
+
// })
|
|
16595
16596
|
case RTCEngineType.Core:
|
|
16596
16597
|
return new CoreRTC$1({
|
|
16597
16598
|
appId: data.appid,
|