@maxverse/media-web-sdk
Version:
1,062 lines (1,050 loc) • 62.8 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var livekitClient = require('livekit-client');
function _iterableToArrayLimit(arr, i) {
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
if (null != _i) {
var _s,
_e,
_x,
_r,
_arr = [],
_n = !0,
_d = !1;
try {
if (_x = (_i = _i.call(arr)).next, 0 === i) {
if (Object(_i) !== _i) return;
_n = !1;
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
} catch (err) {
_d = !0, _e = err;
} finally {
try {
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
} finally {
if (_d) throw _e;
}
}
return _arr;
}
}
function _regeneratorRuntime() {
_regeneratorRuntime = function () {
return exports;
};
var exports = {},
Op = Object.prototype,
hasOwn = Op.hasOwnProperty,
defineProperty = Object.defineProperty || function (obj, key, desc) {
obj[key] = desc.value;
},
$Symbol = "function" == typeof Symbol ? Symbol : {},
iteratorSymbol = $Symbol.iterator || "@@iterator",
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}), obj[key];
}
try {
define({}, "");
} catch (err) {
define = function (obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
generator = Object.create(protoGenerator.prototype),
context = new Context(tryLocsList || []);
return defineProperty(generator, "_invoke", {
value: makeInvokeMethod(innerFn, self, context)
}), generator;
}
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
exports.wrap = wrap;
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function () {
return this;
});
var getProto = Object.getPrototypeOf,
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function (method) {
define(prototype, method, function (arg) {
return this._invoke(method, arg);
});
});
}
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if ("throw" !== record.type) {
var result = record.arg,
value = result.value;
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
invoke("next", value, resolve, reject);
}, function (err) {
invoke("throw", err, resolve, reject);
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
result.value = unwrapped, resolve(result);
}, function (error) {
return invoke("throw", error, resolve, reject);
});
}
reject(record.arg);
}
var previousPromise;
defineProperty(this, "_invoke", {
value: function (method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function (resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
}
});
}
function makeInvokeMethod(innerFn, self, context) {
var state = "suspendedStart";
return function (method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}
function maybeInvokeDelegate(delegate, context) {
var methodName = context.method,
method = delegate.iterator[methodName];
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
var record = tryCatch(method, delegate.iterator, context.arg);
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
var info = record.arg;
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
}
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal", delete record.arg, entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
}
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) return iteratorMethod.call(iterable);
if ("function" == typeof iterable.next) return iterable;
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
return next.value = undefined, next.done = !0, next;
};
return next.next = next;
}
}
return {
next: doneResult
};
}
function doneResult() {
return {
value: undefined,
done: !0
};
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
value: GeneratorFunctionPrototype,
configurable: !0
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
value: GeneratorFunction,
configurable: !0
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
}, exports.mark = function (genFun) {
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
}, exports.awrap = function (arg) {
return {
__await: arg
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
return this;
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
void 0 === PromiseImpl && (PromiseImpl = Promise);
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
return result.done ? result.value : iter.next();
});
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
return this;
}), define(Gp, "toString", function () {
return "[object Generator]";
}), exports.keys = function (val) {
var object = Object(val),
keys = [];
for (var key in object) keys.push(key);
return keys.reverse(), function next() {
for (; keys.length;) {
var key = keys.pop();
if (key in object) return next.value = key, next.done = !1, next;
}
return next.done = !0, next;
};
}, exports.values = values, Context.prototype = {
constructor: Context,
reset: function (skipTempReset) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
},
stop: function () {
this.done = !0;
var rootRecord = this.tryEntries[0].completion;
if ("throw" === rootRecord.type) throw rootRecord.arg;
return this.rval;
},
dispatchException: function (exception) {
if (this.done) throw exception;
var context = this;
function handle(loc, caught) {
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i],
record = entry.completion;
if ("root" === entry.tryLoc) return handle("end");
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc"),
hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
} else if (hasCatch) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
} else {
if (!hasFinally) throw new Error("try statement without catch or finally");
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
}
}
}
},
abrupt: function (type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
var record = finallyEntry ? finallyEntry.completion : {};
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
},
complete: function (record, afterLoc) {
if ("throw" === record.type) throw record.arg;
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
},
finish: function (finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
}
},
catch: function (tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if ("throw" === record.type) {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function (iterable, resultName, nextLoc) {
return this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
}
}, exports;
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function () {
var self = this,
args = arguments;
return new Promise(function (resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
var id = 0;
function _classPrivateFieldLooseKey(name) {
return "__private_" + id++ + "_" + name;
}
function _classPrivateFieldLooseBase(receiver, privateKey) {
if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
throw new TypeError("attempted to use private field on non-instance");
}
return receiver;
}
// eslint-disable-next-line @typescript-eslint/ban-types
var sequenceHandler = function sequenceHandler(handler) {
if (handler) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
handler.apply.apply(handler, [undefined].concat(args));
}
};
var _room$4 = /*#__PURE__*/_classPrivateFieldLooseKey("room");
var _isLocalVideoEnabled = /*#__PURE__*/_classPrivateFieldLooseKey("isLocalVideoEnabled");
var _isLocalAudioEnabled = /*#__PURE__*/_classPrivateFieldLooseKey("isLocalAudioEnabled");
var _videoDeviceId = /*#__PURE__*/_classPrivateFieldLooseKey("videoDeviceId");
var _audioDeviceId = /*#__PURE__*/_classPrivateFieldLooseKey("audioDeviceId");
var LocalTrackController = /*#__PURE__*/_createClass(function LocalTrackController(room, isVideoEnabled, isAudioEnabled, videoDeviceId, audioDeviceId) {
var _this = this;
_classCallCheck(this, LocalTrackController);
Object.defineProperty(this, _room$4, {
writable: true,
value: void 0
});
Object.defineProperty(this, _isLocalVideoEnabled, {
writable: true,
value: void 0
});
Object.defineProperty(this, _isLocalAudioEnabled, {
writable: true,
value: void 0
});
Object.defineProperty(this, _videoDeviceId, {
writable: true,
value: void 0
});
Object.defineProperty(this, _audioDeviceId, {
writable: true,
value: void 0
});
this.toggleCam = function () {
var _classPrivateFieldLoo, _classPrivateFieldLoo2;
var isEnabled = (_classPrivateFieldLoo = (_classPrivateFieldLoo2 = _classPrivateFieldLooseBase(_this, _room$4)[_room$4].localParticipant.getTrack(livekitClient.Track.Source.Camera)) === null || _classPrivateFieldLoo2 === void 0 ? void 0 : _classPrivateFieldLoo2.isMuted) !== null && _classPrivateFieldLoo !== void 0 ? _classPrivateFieldLoo : true;
_classPrivateFieldLooseBase(_this, _room$4)[_room$4].localParticipant.setCameraEnabled(isEnabled);
};
this.toggleMic = function () {
var _classPrivateFieldLoo3, _classPrivateFieldLoo4;
var isEnabled = (_classPrivateFieldLoo3 = (_classPrivateFieldLoo4 = _classPrivateFieldLooseBase(_this, _room$4)[_room$4].localParticipant.getTrack(livekitClient.Track.Source.Microphone)) === null || _classPrivateFieldLoo4 === void 0 ? void 0 : _classPrivateFieldLoo4.isMuted) !== null && _classPrivateFieldLoo3 !== void 0 ? _classPrivateFieldLoo3 : true;
_classPrivateFieldLooseBase(_this, _room$4)[_room$4].localParticipant.setMicrophoneEnabled(isEnabled);
};
this.toggleScreenShare = function () {
var _classPrivateFieldLoo5;
var isEnabled = (_classPrivateFieldLoo5 = _classPrivateFieldLooseBase(_this, _room$4)[_room$4].localParticipant.isScreenShareEnabled) !== null && _classPrivateFieldLoo5 !== void 0 ? _classPrivateFieldLoo5 : true;
_classPrivateFieldLooseBase(_this, _room$4)[_room$4].localParticipant.setScreenShareEnabled(!isEnabled);
};
this.initializeLocalTracks = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (_classPrivateFieldLooseBase(_this, _room$4)[_room$4].options.videoCaptureDefaults && _classPrivateFieldLooseBase(_this, _videoDeviceId)[_videoDeviceId]) {
_classPrivateFieldLooseBase(_this, _room$4)[_room$4].options.videoCaptureDefaults.deviceId = _classPrivateFieldLooseBase(_this, _videoDeviceId)[_videoDeviceId];
}
if (_classPrivateFieldLooseBase(_this, _room$4)[_room$4].options.audioCaptureDefaults && _classPrivateFieldLooseBase(_this, _audioDeviceId)[_audioDeviceId]) {
_classPrivateFieldLooseBase(_this, _room$4)[_room$4].options.audioCaptureDefaults.deviceId = _classPrivateFieldLooseBase(_this, _audioDeviceId)[_audioDeviceId];
}
_context.next = 4;
return _classPrivateFieldLooseBase(_this, _room$4)[_room$4].localParticipant.setCameraEnabled(_classPrivateFieldLooseBase(_this, _isLocalVideoEnabled)[_isLocalVideoEnabled]);
case 4:
_context.next = 6;
return _classPrivateFieldLooseBase(_this, _room$4)[_room$4].localParticipant.setMicrophoneEnabled(_classPrivateFieldLooseBase(_this, _isLocalAudioEnabled)[_isLocalAudioEnabled]);
case 6:
case "end":
return _context.stop();
}
}, _callee);
}));
_classPrivateFieldLooseBase(this, _room$4)[_room$4] = room;
_classPrivateFieldLooseBase(this, _isLocalVideoEnabled)[_isLocalVideoEnabled] = isVideoEnabled;
_classPrivateFieldLooseBase(this, _isLocalAudioEnabled)[_isLocalAudioEnabled] = isAudioEnabled;
_classPrivateFieldLooseBase(this, _videoDeviceId)[_videoDeviceId] = videoDeviceId;
_classPrivateFieldLooseBase(this, _audioDeviceId)[_audioDeviceId] = audioDeviceId;
});
var LocalTrackController$1 = LocalTrackController;
var _room$3 = /*#__PURE__*/_classPrivateFieldLooseKey("room");
var _allParticipant = /*#__PURE__*/_classPrivateFieldLooseKey("allParticipant");
var Presenter = /*#__PURE__*/_createClass(function Presenter(room) {
var _this = this;
_classCallCheck(this, Presenter);
Object.defineProperty(this, _allParticipant, {
get: _get_allParticipant,
set: void 0
});
Object.defineProperty(this, _room$3, {
writable: true,
value: void 0
});
this.find = function (userId) {
var presenter = _classPrivateFieldLooseBase(_this, _allParticipant)[_allParticipant].find(function (participant) {
return participant.identity === userId;
});
return presenter;
};
_classPrivateFieldLooseBase(this, _room$3)[_room$3] = room;
});
function _get_allParticipant() {
return [_classPrivateFieldLooseBase(this, _room$3)[_room$3].localParticipant].concat(_toConsumableArray(Array.from(_classPrivateFieldLooseBase(this, _room$3)[_room$3].participants.values())));
}
var Presenter$1 = Presenter;
var TargetParticipantFactory = /*#__PURE__*/_createClass(function TargetParticipantFactory() {
_classCallCheck(this, TargetParticipantFactory);
});
TargetParticipantFactory.create = /*#__PURE__*/function () {
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(participant) {
var _yield$Promise$all, _yield$Promise$all2, videoTrackPublication, audioTrackPublication, screenShareTrackPublication;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return Promise.all([participant.getTrack(livekitClient.Track.Source.Camera), participant.getTrack(livekitClient.Track.Source.Microphone), participant.getTrack(livekitClient.Track.Source.ScreenShare)]);
case 2:
_yield$Promise$all = _context.sent;
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
videoTrackPublication = _yield$Promise$all2[0];
audioTrackPublication = _yield$Promise$all2[1];
screenShareTrackPublication = _yield$Promise$all2[2];
return _context.abrupt("return", new TargetParticipant(participant, videoTrackPublication, audioTrackPublication, screenShareTrackPublication));
case 8:
case "end":
return _context.stop();
}
}, _callee);
}));
return function (_x) {
return _ref.apply(this, arguments);
};
}();
var _participant = /*#__PURE__*/_classPrivateFieldLooseKey("participant");
var _videoTrackPublication = /*#__PURE__*/_classPrivateFieldLooseKey("videoTrackPublication");
var _audioTrackPublication = /*#__PURE__*/_classPrivateFieldLooseKey("audioTrackPublication");
var _screenShareTrackPublication = /*#__PURE__*/_classPrivateFieldLooseKey("screenShareTrackPublication");
var TargetParticipant = /*#__PURE__*/function () {
function TargetParticipant(participant, videoTrackPublication, audioTrackPublication, screenShareTrackPublication) {
var _this = this;
_classCallCheck(this, TargetParticipant);
Object.defineProperty(this, _participant, {
writable: true,
value: void 0
});
Object.defineProperty(this, _videoTrackPublication, {
writable: true,
value: void 0
});
Object.defineProperty(this, _audioTrackPublication, {
writable: true,
value: void 0
});
Object.defineProperty(this, _screenShareTrackPublication, {
writable: true,
value: void 0
});
this.attachTrackToElement = function (element, trackSource) {
if (element instanceof HTMLVideoElement && _this.isVideoEnabled) {
if (_this.isVideoEnabled && trackSource === 'video') {
var _classPrivateFieldLoo, _classPrivateFieldLoo2;
(_classPrivateFieldLoo = _classPrivateFieldLooseBase(_this, _videoTrackPublication)[_videoTrackPublication]) === null || _classPrivateFieldLoo === void 0 ? void 0 : (_classPrivateFieldLoo2 = _classPrivateFieldLoo.videoTrack) === null || _classPrivateFieldLoo2 === void 0 ? void 0 : _classPrivateFieldLoo2.attach(element);
}
if (_this.isScreenShareEnabled && trackSource === 'audio') {
var _classPrivateFieldLoo3, _classPrivateFieldLoo4;
(_classPrivateFieldLoo3 = _classPrivateFieldLooseBase(_this, _screenShareTrackPublication)[_screenShareTrackPublication]) === null || _classPrivateFieldLoo3 === void 0 ? void 0 : (_classPrivateFieldLoo4 = _classPrivateFieldLoo3.videoTrack) === null || _classPrivateFieldLoo4 === void 0 ? void 0 : _classPrivateFieldLoo4.attach(element);
}
}
if (_this.isAudioEnabled && element instanceof HTMLAudioElement) {
if (trackSource === 'audio') {
var _classPrivateFieldLoo5, _classPrivateFieldLoo6;
(_classPrivateFieldLoo5 = _classPrivateFieldLooseBase(_this, _audioTrackPublication)[_audioTrackPublication]) === null || _classPrivateFieldLoo5 === void 0 ? void 0 : (_classPrivateFieldLoo6 = _classPrivateFieldLoo5.audioTrack) === null || _classPrivateFieldLoo6 === void 0 ? void 0 : _classPrivateFieldLoo6.attach(element);
}
}
};
this.detachTrackFromElement = function (element, trackSource) {
if (element instanceof HTMLVideoElement) {
if (trackSource === 'video') {
var _classPrivateFieldLoo7, _classPrivateFieldLoo8;
(_classPrivateFieldLoo7 = _classPrivateFieldLooseBase(_this, _videoTrackPublication)[_videoTrackPublication]) === null || _classPrivateFieldLoo7 === void 0 ? void 0 : (_classPrivateFieldLoo8 = _classPrivateFieldLoo7.videoTrack) === null || _classPrivateFieldLoo8 === void 0 ? void 0 : _classPrivateFieldLoo8.detach(element);
}
if (trackSource === 'screenShare') {
var _classPrivateFieldLoo9, _classPrivateFieldLoo10;
(_classPrivateFieldLoo9 = _classPrivateFieldLooseBase(_this, _screenShareTrackPublication)[_screenShareTrackPublication]) === null || _classPrivateFieldLoo9 === void 0 ? void 0 : (_classPrivateFieldLoo10 = _classPrivateFieldLoo9.videoTrack) === null || _classPrivateFieldLoo10 === void 0 ? void 0 : _classPrivateFieldLoo10.detach(element);
}
}
if (element instanceof HTMLAudioElement) {
if (trackSource === 'audio') {
var _classPrivateFieldLoo11, _classPrivateFieldLoo12;
(_classPrivateFieldLoo11 = _classPrivateFieldLooseBase(_this, _audioTrackPublication)[_audioTrackPublication]) === null || _classPrivateFieldLoo11 === void 0 ? void 0 : (_classPrivateFieldLoo12 = _classPrivateFieldLoo11.audioTrack) === null || _classPrivateFieldLoo12 === void 0 ? void 0 : _classPrivateFieldLoo12.detach(element);
}
}
};
_classPrivateFieldLooseBase(this, _participant)[_participant] = participant;
_classPrivateFieldLooseBase(this, _videoTrackPublication)[_videoTrackPublication] = videoTrackPublication;
_classPrivateFieldLooseBase(this, _audioTrackPublication)[_audioTrackPublication] = audioTrackPublication;
_classPrivateFieldLooseBase(this, _screenShareTrackPublication)[_screenShareTrackPublication] = screenShareTrackPublication;
}
_createClass(TargetParticipant, [{
key: "sid",
get: function get() {
return _classPrivateFieldLooseBase(this, _participant)[_participant].sid;
}
}, {
key: "identity",
get: function get() {
return _classPrivateFieldLooseBase(this, _participant)[_participant].identity;
}
}, {
key: "name",
get: function get() {
return _classPrivateFieldLooseBase(this, _participant)[_participant].name;
}
}, {
key: "isLocal",
get: function get() {
return _classPrivateFieldLooseBase(this, _participant)[_participant] instanceof livekitClient.LocalParticipant;
}
}, {
key: "isVideoEnabled",
get: function get() {
var _classPrivateFieldLoo13, _classPrivateFieldLoo14, _classPrivateFieldLoo15, _classPrivateFieldLoo16;
var isSubscribed = (_classPrivateFieldLoo13 = (_classPrivateFieldLoo14 = _classPrivateFieldLooseBase(this, _videoTrackPublication)[_videoTrackPublication]) === null || _classPrivateFieldLoo14 === void 0 ? void 0 : _classPrivateFieldLoo14.isSubscribed) !== null && _classPrivateFieldLoo13 !== void 0 ? _classPrivateFieldLoo13 : false;
var isValidTrack = (_classPrivateFieldLoo15 = (_classPrivateFieldLoo16 = _classPrivateFieldLooseBase(this, _videoTrackPublication)[_videoTrackPublication]) === null || _classPrivateFieldLoo16 === void 0 ? void 0 : _classPrivateFieldLoo16.videoTrack) !== null && _classPrivateFieldLoo15 !== void 0 ? _classPrivateFieldLoo15 : false;
return isSubscribed && isValidTrack && _classPrivateFieldLooseBase(this, _participant)[_participant].isCameraEnabled;
}
}, {
key: "isAudioEnabled",
get: function get() {
var _classPrivateFieldLoo17, _classPrivateFieldLoo18, _classPrivateFieldLoo19, _classPrivateFieldLoo20;
var isSubscribed = (_classPrivateFieldLoo17 = (_classPrivateFieldLoo18 = _classPrivateFieldLooseBase(this, _audioTrackPublication)[_audioTrackPublication]) === null || _classPrivateFieldLoo18 === void 0 ? void 0 : _classPrivateFieldLoo18.isSubscribed) !== null && _classPrivateFieldLoo17 !== void 0 ? _classPrivateFieldLoo17 : false;
var isValidTrack = (_classPrivateFieldLoo19 = (_classPrivateFieldLoo20 = _classPrivateFieldLooseBase(this, _audioTrackPublication)[_audioTrackPublication]) === null || _classPrivateFieldLoo20 === void 0 ? void 0 : _classPrivateFieldLoo20.audioTrack) !== null && _classPrivateFieldLoo19 !== void 0 ? _classPrivateFieldLoo19 : false;
return isSubscribed && isValidTrack && _classPrivateFieldLooseBase(this, _participant)[_participant].isMicrophoneEnabled;
}
}, {
key: "isScreenShareEnabled",
get: function get() {
var _classPrivateFieldLoo21, _classPrivateFieldLoo22, _classPrivateFieldLoo23, _classPrivateFieldLoo24;
var isSubscribed = (_classPrivateFieldLoo21 = (_classPrivateFieldLoo22 = _classPrivateFieldLooseBase(this, _screenShareTrackPublication)[_screenShareTrackPublication]) === null || _classPrivateFieldLoo22 === void 0 ? void 0 : _classPrivateFieldLoo22.isSubscribed) !== null && _classPrivateFieldLoo21 !== void 0 ? _classPrivateFieldLoo21 : false;
var isValidTrack = (_classPrivateFieldLoo23 = (_classPrivateFieldLoo24 = _classPrivateFieldLooseBase(this, _screenShareTrackPublication)[_screenShareTrackPublication]) === null || _classPrivateFieldLoo24 === void 0 ? void 0 : _classPrivateFieldLoo24.videoTrack) !== null && _classPrivateFieldLoo23 !== void 0 ? _classPrivateFieldLoo23 : false;
return isSubscribed && isValidTrack;
}
}]);
return TargetParticipant;
}();
var _room$2 = /*#__PURE__*/_classPrivateFieldLooseKey("room");
var _handler$1 = /*#__PURE__*/_classPrivateFieldLooseKey("handler");
var _onLocalTrackUpdated = /*#__PURE__*/_classPrivateFieldLooseKey("onLocalTrackUpdated");
var _onRemoteTrackUpdated = /*#__PURE__*/_classPrivateFieldLooseKey("onRemoteTrackUpdated");
var _onTrackSwitched = /*#__PURE__*/_classPrivateFieldLooseKey("onTrackSwitched");
var ParticipantEventContainer = /*#__PURE__*/_createClass(function ParticipantEventContainer(room, handler) {
var _this = this;
_classCallCheck(this, ParticipantEventContainer);
Object.defineProperty(this, _room$2, {
writable: true,
value: void 0
});
Object.defineProperty(this, _handler$1, {
writable: true,
value: void 0
});
this.bindParticipantEvents = function (participant) {
if (participant instanceof livekitClient.LocalParticipant) {
participant.on(livekitClient.ParticipantEvent.LocalTrackPublished, _classPrivateFieldLooseBase(_this, _onLocalTrackUpdated)[_onLocalTrackUpdated]).on(livekitClient.ParticipantEvent.LocalTrackUnpublished, _classPrivateFieldLooseBase(_this, _onLocalTrackUpdated)[_onLocalTrackUpdated]);
}
participant.on(livekitClient.ParticipantEvent.TrackSubscribed, function (remoteTrack, remoteTrackPublication) {
_classPrivateFieldLooseBase(_this, _onRemoteTrackUpdated)[_onRemoteTrackUpdated](participant, remoteTrack, remoteTrackPublication);
}).on(livekitClient.ParticipantEvent.TrackUnsubscribed, function (remoteTrack, remoteTrackPublication) {
_classPrivateFieldLooseBase(_this, _onRemoteTrackUpdated)[_onRemoteTrackUpdated](participant, remoteTrack, remoteTrackPublication);
}).on(livekitClient.ParticipantEvent.TrackMuted, function (trackPublication) {
_classPrivateFieldLooseBase(_this, _onTrackSwitched)[_onTrackSwitched](participant, trackPublication);
}).on(livekitClient.ParticipantEvent.TrackUnmuted, function (trackPublication) {
_classPrivateFieldLooseBase(_this, _onTrackSwitched)[_onTrackSwitched](participant, trackPublication);
});
};
Object.defineProperty(this, _onLocalTrackUpdated, {
writable: true,
value: function () {
var _value = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(localTrackPublication) {
var source, targetParticipant;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
source = localTrackPublication.source;
_context.next = 3;
return TargetParticipantFactory.create(_classPrivateFieldLooseBase(_this, _room$2)[_room$2].localParticipant);
case 3:
targetParticipant = _context.sent;
if (source === livekitClient.Track.Source.Camera) {
sequenceHandler(_classPrivateFieldLooseBase(_this, _handler$1)[_handler$1].onLocalVideoUpdated, [targetParticipant]);
}
if (source === livekitClient.Track.Source.Microphone) {
sequenceHandler(_classPrivateFieldLooseBase(_this, _handler$1)[_handler$1].onLocalAudioUpdated, [targetParticipant]);
}
if (source === livekitClient.Track.Source.ScreenShare) {
sequenceHandler(_classPrivateFieldLooseBase(_this, _handler$1)[_handler$1].onLocalScreenShareUpdated, [targetParticipant]);
}
case 7:
case "end":
return _context.stop();
}
}, _callee);
}));
function value(_x) {
return _value.apply(this, arguments);
}
return value;
}()
});
Object.defineProperty(this, _onRemoteTrackUpdated, {
writable: true,
value: function () {
var _value2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(participant, _remoteTrack, remoteTrackPublication) {
var source, targetParticipant;
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
source = remoteTrackPublication.source;
_context2.next = 3;
return TargetParticipantFactory.create(participant);
case 3:
targetParticipant = _context2.sent;
if (source === livekitClient.Track.Source.Camera) {
sequenceHandler(_classPrivateFieldLooseBase(_this, _handler$1)[_handler$1].onRemoteVideoUpdated, [targetParticipant]);
}
if (source === livekitClient.Track.Source.Microphone) {
sequenceHandler(_classPrivateFieldLooseBase(_this, _handler$1)[_handler$1].onRemoteAudioUpdated, [targetParticipant]);
}
if (source === livekitClient.Track.Source.ScreenShare) {
sequenceHandler(_classPrivateFieldLooseBase(_this, _handler$1)[_handler$1].onRemoteScreenShareUpdated, [targetParticipant]);
}
case 7:
case "end":
return _context2.stop();
}
}, _callee2);
}));
function value(_x2, _x3, _x4) {
return _value2.apply(this, arguments);
}
return value;
}()
});
Object.defineProperty(this, _onTrackSwitched, {
writable: true,
value: function () {
var _value3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(participant, trackPublication) {
var source, targetParticipant;
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
source = trackPublication.source;
_context3.next = 3;
return TargetParticipantFactory.create(participant);
case 3:
targetParticipant = _context3.sent;
if (source === livekitClient.Track.Source.Camera) {
sequenceHandler(_classPrivateFieldLooseBase(_this, _handler$1)[_handler$1].onVideoSwitched, [targetParticipant]);
}
if (source === livekitClient.Track.Source.Microphone) {
sequenceHandler(_classPrivateFieldLooseBase(_this, _handler$1)[_handler$1].onAudioSwitched, [targetParticipant]);
}
case 6:
case "end":
return _context3.stop();
}
}, _callee3);
}));
function value(_x5, _x6) {
return _value3.apply(this, arguments);
}
return value;
}()
});
_classPrivateFieldLooseBase(this, _room$2)[_room$2] = room;
_classPrivateFieldLooseBase(this, _handler$1)[_handler$1] = handler;
});
var ParticipantEventContainer$1 = ParticipantEventContainer;
var InitialConnectionStatus = /*#__PURE__*/function (InitialConnectionStatus) {
InitialConnectionStatus["CONNECTION_SUCCESS"] = "CONNECTION_SUCCESS";
InitialConnectionStatus["CONNECTION_FAIL"] = "CONNECTION_FAIL";
InitialConnectionStatus["PREPARE_CONNECTION_SUCCESS"] = "PREPARE_CONNECTION_SUCCESS";
InitialConnectionStatus["PREPARE_CONNECTION_FAIL"] = "PREPARE_CONNECTION_FAIL";
return InitialConnectionStatus;
}({});
var _room$1 = /*#__PURE__*/_classPrivateFieldLooseKey("room");
var _url = /*#__PURE__*/_classPrivateFieldLooseKey("url");
var Connection = /*#__PURE__*/_createClass(function Connection(room) {
var _this = this;
_classCallCheck(this, Connection);
Object.defineProperty(this, _room$1, {
writable: true,
value: void 0
});
Object.defineProperty(this, _url, {
writable: true,
value: void 0
});
this.prepareConnection = /*#__PURE__*/function () {
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
url = url || _classPrivateFieldLooseBase(_this, _url)[_url];
_context.prev = 1;
_context.next = 4;
return _classPrivateFieldLooseBase(_this, _room$1)[_room$1].prepareConnection(url);
case 4:
return _context.abrupt("return", InitialConnectionStatus.PREPARE_CONNECTION_SUCCESS);
case 7:
_context.prev = 7;
_context.t0 = _context["catch"](1);
throw new Error('prepare connection fail');
case 10:
case "end":
return _context.stop();
}
}, _callee, null, [[1, 7]]);
}));
return function (_x) {
return _ref.apply(this, arguments);
};
}();
this.connectToRoom = /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(token, url) {
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
url = url || _classPrivateFieldLooseBase(_this, _url)[_url];
_context2.prev = 1;
_context2.next = 4;
return _classPrivateFieldLooseBase(_this, _room$1)[_room$1].connect(url, token);
case 4:
return _context2.abrupt("return", InitialConnectionStatus.CONNECTION_SUCCESS);
case 7:
_context2.prev = 7;
_context2.t0 = _context2["catch"](1);
throw new Error('connection fail');
case 10:
case "end":
return _context2.stop();
}
}, _callee2, null, [[1, 7]]);
}));
return function (_x2, _x3) {
return _ref2.apply(this, arguments);
};
}();
this.disConnectRoom = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
_classPrivateFieldLooseBase(_this, _room$1)[_room$1].disconnect();
case 1:
case "end":
return _context3.stop();
}
}, _callee3);
}));
_classPrivateFieldLooseBase(this, _room$1)[_room$1] = room;
_classPrivateFieldLooseBase(this, _url)[_url] = 'wss://media.maxverse.io';
});
var Connection$1 = Connection;
var MetadataSort = /*#__PURE__*/function (MetadataSort) {
MetadataSort["PRESENTER"] = "presenter";
MetadataSort["UNKNOWN"] = "unknown";
return MetadataSort;
}({});
var _presenter = /*#__PURE__*/_classPrivateFieldLooseKey("presenter");
var _parse = /*#__PURE__*/_classPrivateFieldLooseKey("parse");
var DataChannelContainer = /*#__PURE__*/_createClass(function DataChannelContainer(_presenter2) {
var _this = this;
_classCallCheck(this, DataChannelContainer);
Object.defineProperty(this, _presenter, {
writable: true,
value: void 0
});
Object.defineProperty(this, _parse, {
writable: true,
value: function value(data) {
return JSON.parse(data);
}
});
this.onFetchMetaDataHandler = function (metadata) {
var parsedMetadata = _classPrivateFieldLooseBase(_this, _parse)[_parse](metadata);
if (!parsedMetadata) {
console.error('do not found valid metadata');
return {
type: MetadataSort.UNKNOWN
};
}
if (parsedMetadata.presenter) {
var userId = parsedMetadata.presenter;
var presenter = _classPrivateFieldLooseBase(_this, _presenter)[_presenter].find(userId);
if (!presenter) {
console.error('do not found presenter');
return {
type: MetadataSort.UNKNOWN
};
}
return {
type: MetadataSort.PRESENTER,
payload: presenter
};
}
return {
type: MetadataSort.UNKNOWN
};
};
_classPrivateFieldLooseBase(this, _presenter)[_presenter] = _presenter2;
});
var DataChannelContainer$1 = DataChannelContainer;
var _room = /*#__PURE__*/_classPrivateFieldLooseKey("room");
var _handler = /*#__PURE__*/_classPrivateFieldLooseKey("handler");
var _dataChannelContainer = /*#__PURE__*/_classPrivateFieldLooseKey("dataChannelContainer");
var RoomEventContainer = /*#__PURE__*/_createClass(function RoomEventContainer(room, dataChannelContainer, handler) {
var _this = this;
_classCallCheck(this, RoomEventContainer);
Object.defineProperty(this, _room, {
writable: true,
value: void 0
});
Object.defineProperty(this, _handler, {
writable: true,
value: void 0
});
Object.defineProperty(this, _dataChannelContainer, {
writable: true,
value: void 0
});
this.bindRoomEvents = function () {
_classPrivateFieldLooseBase(_this, _room)[_room].on(livekitClient.RoomEvent.ParticipantConnected, _this.onParticipantConnected).on(livekitClient.RoomEvent.ParticipantDisconnected, _this.onParticipantDisconnected).on(livekitClient.RoomEvent.ConnectionStateChanged, _this.onConnectionStateChanged).on(livekitClient.RoomEvent.RoomMetadataChanged, _this.onRoomMetadataChanged);
};
this.initializeCurrentRoomStatus = function (participant) {
_this.onParticipantConnected(participant);
};
this.onParticipantConnected = /*#__PURE__*/function () {
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(participant) {
var targetParticipant;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return TargetParticipantFactory.create(participant);
case 2:
targetParticipant = _context.sent;
sequenceHandler(_classPrivateFieldLooseBase(_this, _handler)[_handler].onParticipantConnected, [targetParticipant]);
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return function (_x) {
return _ref.apply(this, arguments);
};
}();
this.onParticipantDisconnected = /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(participant) {
var targetParticipant;
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return TargetParticipantFactory.create(participant);
case 2:
targetParticipant = _context2.sent;
sequenceHandler(_classPrivateFieldLooseBase(_this, _handler)[_handler].onParticipantDisconnected, [targetParticipant]);
case 4:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function (_x2) {
return _ref2.apply(this, arguments);
};
}();
this.onConnectionStateChanged = /*#__PURE__*/function () {
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(connectionState) {
var currentConnectionInfo;
return _regeneratorRuntime()