@100mslive/hms-virtual-background 1.3.4 → 1.3.6
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/HMSVirtualBackgroundPlugin.d.ts +17 -5
- package/dist/hms-virtual-background.cjs.development.js +233 -79
- package/dist/hms-virtual-background.cjs.development.js.map +1 -1
- package/dist/hms-virtual-background.cjs.production.min.js +1 -1
- package/dist/hms-virtual-background.cjs.production.min.js.map +1 -1
- package/dist/hms-virtual-background.esm.js +233 -79
- package/dist/hms-virtual-background.esm.js.map +1 -1
- package/package.json +13 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hms-virtual-background.cjs.production.min.js","sources":["../node_modules/regenerator-runtime/runtime.js","../src/defineTFLite.ts","../src/HMSVirtualBackgroundPlugin.ts"],"sourcesContent":["/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","const pkg = require(\"../package.json\")\nconst BASE_URL = `https://unpkg.com/${pkg.name}/src`;\nconst TAG = 'VBProcessor';\nconst TFLITE_JS_FILE = 'tflite/tflite.js';\nconst TFLITE_SIMD_JS_FILE = 'tflite/tflite-simd.js';\nconst MODEL_FILE_NAME = 'models/selfie_segmentation_landscape.tflite';\n\nconst loadScript = (src: string) => {\n return new Promise(function (resolve, reject) {\n const s = document.createElement('script');\n s.src = src;\n s.onload = resolve;\n s.onerror = reject;\n document.head.appendChild(s);\n });\n};\n\nconst loadTFLiteModel = async() =>{\n let tfLite: any;\n let path = BASE_URL + \"/\" + TFLITE_SIMD_JS_FILE;\n await loadScript(path);\n try{\n //@ts-ignore\n tfLite = await createTFLiteSIMDModule();\n }catch{\n console.warn('SIMD not supported. You may experience poor virtual background effect.');\n path = BASE_URL + \"/\" + TFLITE_JS_FILE;\n await loadScript(path);\n // @ts-ignore\n tfLite = await createTFLiteModule();\n }\n return tfLite;\n};\n\nconst loadTFLite = async () => {\n const modelPath = BASE_URL + \"/\" + MODEL_FILE_NAME;\n const [tfLite, modelResponse] = await Promise.all([loadTFLiteModel(), fetch(modelPath)]);\n\n const model = await modelResponse.arrayBuffer();\n const modelBufferOffset = tfLite._getModelBufferMemoryOffset();\n tfLite.HEAPU8.set(new Uint8Array(model), modelBufferOffset);\n tfLite._loadModel(model.byteLength);\n\n console.log(TAG,'Input memory offset:', tfLite._getInputMemoryOffset())\n console.log(TAG,'Input height:', tfLite._getInputHeight())\n console.log(TAG,'Input width:', tfLite._getInputWidth())\n console.log(TAG,'Input channels:', tfLite._getInputChannelCount())\n\n return tfLite;\n}\n\nexport { loadTFLite };","import { loadTFLite } from './defineTFLite'\nimport '@tensorflow/tfjs-backend-webgl';\nimport { HMSVideoPlugin, HMSVideoPluginType} from \"@100mslive/hms-video\";\n\nconst TAG = 'VBProcessor';\nconst pkg = require(\"../package.json\");\n\nconst minVideoWidthForSharpening = 214;\nconst maxVideoWidthForSharpening = 855;\nconst minVideoHeightForSharpening = 120;\nconst maxVideoHeightForSharpening = 720;\n\n\nexport class HMSVirtualBackgroundPlugin implements HMSVideoPlugin {\n background: string | HTMLImageElement\n personMaskWidth: number\n personMaskHeight: number\n isVirtualBackground: boolean\n backgroundImage: HTMLImageElement | undefined\n loadModelCalled: boolean;\n blurValue: any\n tfLite: any\n tfLitePromise: any\n modelName: string\n\n input: HTMLCanvasElement | null\n output: HTMLCanvasElement | null\n outputCtx: CanvasRenderingContext2D | null\n timerID: number\n imageAspectRatio: number\n\n personMaskPixelCount: number;\n personMask: ImageData;\n personMaskCanvas: HTMLCanvasElement;\n personMaskCtx: any;\n filters: any;\n enableSharpening?: boolean | false;\n\n constructor(background: string, enableSharpening: boolean = false) {\n this.background = background;\n this.personMaskWidth = 256;\n this.personMaskHeight = 144;\n this.isVirtualBackground = false;\n this.blurValue = '10px'\n this.loadModelCalled = false;\n this.tfLite = null;\n this.modelName = 'landscape-segmentation';\n\n this.outputCtx = null;\n this.input = null;\n this.output = null;\n this.timerID = 0;\n this.imageAspectRatio = 1;\n\n this.personMaskPixelCount = this.personMaskWidth * this.personMaskHeight;\n this.personMask = new ImageData(this.personMaskWidth, this.personMaskHeight);\n this.personMaskCanvas = document.createElement('canvas');\n this.personMaskCanvas.width = this.personMaskWidth;\n this.personMaskCanvas.height = this.personMaskHeight;\n this.personMaskCtx = this.personMaskCanvas.getContext('2d');\n\n this.filters = {};\n this.enableSharpening = enableSharpening;\n\n this.log(TAG, \"Virtual Background plugin created\");\n this.setBackground(this.background);\n }\n\n async init(): Promise<void> {\n\n if (!this.loadModelCalled) {\n this.log(TAG, \"PREVIOUS LOADED MODEL IS \", this.tfLite);\n this.loadModelCalled = true;\n this.tfLitePromise = loadTFLite();\n this.tfLite = await this.tfLitePromise;\n } else {\n //either it is loading or loaded\n await this.tfLitePromise;\n }\n if(this.enableSharpening){\n this.initSharpenFilter();\n }\n }\n\n isSupported(): boolean {\n //support chrome, firefox, edge TODO: check this\n return navigator.userAgent.indexOf(\"Chrome\") != -1 || navigator.userAgent.indexOf(\"Firefox\") != -1 || navigator.userAgent.indexOf(\"Edg\") != -1;\n }\n\n getName(): string {\n return pkg.name;\n }\n\n getPluginType(): HMSVideoPluginType {\n return HMSVideoPluginType.TRANSFORM;\n }\n\n async setBackground(path?: string | HTMLImageElement) {\n if (path !== \"\") {\n if (path === \"none\") {\n this.log(TAG,'setting background to :', path);\n this.background = \"none\";\n this.isVirtualBackground = false;\n } else if (path === \"blur\") {\n this.log(TAG,'setting background to :', path);\n this.background = \"blur\";\n this.isVirtualBackground = false;\n } else {\n //Setting virtual background\n const img = await this.setImage(path as HTMLImageElement);\n if(!img || !img.complete || !img.naturalHeight ){\n throw new Error('Invalid image. Provide a valid and successfully loaded HTMLImageElement');\n }\n else{\n this.isVirtualBackground = true;\n this.backgroundImage = img;\n }\n }\n } else {\n this.log(TAG, \"Not updating anything using the previous background Settings\");\n }\n }\n\n stop(): void {\n if (this.isVirtualBackground) {\n this.backgroundImage?.removeAttribute('src');\n }\n if(this.outputCtx){\n this.outputCtx!.fillStyle = `rgb(0, 0, 0)`;\n this.outputCtx!.fillRect(0, 0, this.output!.width, this.output!.height);\n }\n }\n\n processVideoFrame(input: HTMLCanvasElement, output: HTMLCanvasElement, skipProcessing?: boolean): Promise<void> | void {\n if (!input || !output) {\n throw new Error('Plugin invalid input/output');\n }\n\n this.input = input;\n this.output = output;\n\n const ctx = output.getContext('2d');\n if (ctx!.canvas.width !== input.width) {\n ctx!.canvas.width = input.width;\n }\n if (ctx!.canvas.height !== input.height) {\n ctx!.canvas.height = input.height;\n }\n this.outputCtx = ctx!;\n this.imageAspectRatio = input.width / input.height;\n if (this.imageAspectRatio <= 0) {\n throw new Error(\"Invalid input width/height\");\n }\n\n const process = async () => {\n await this.runSegmentation(skipProcessing);\n }\n\n if (this.background === \"none\" && !this.isVirtualBackground) {\n this.outputCtx!.globalCompositeOperation = 'copy';\n this.outputCtx!.filter = 'none';\n this.outputCtx!.drawImage(input, 0, 0, input.width, input.height);\n } else {\n process();\n }\n }\n\n private async setImage(image: HTMLImageElement): Promise<any> {\n image.crossOrigin = 'anonymous';\n return new Promise((resolve, reject) =>{\n image.onload = () => resolve(image)\n image.onerror = reject\n })\n }\n\n private log(tag: string, ...data: any[]){\n console.info(tag, ...data);\n }\n\n private resizeInputData(){\n this.personMaskCtx!.drawImage(\n this.input,\n 0,\n 0,\n this.input!.width,\n this.input!.height,\n 0,\n 0,\n this.personMaskWidth,\n this.personMaskHeight\n )\n\n const imageData = this.personMaskCtx!.getImageData(\n 0,\n 0,\n this.personMaskWidth,\n this.personMaskHeight\n );\n\n const inputMemoryOffset = this.tfLite._getInputMemoryOffset() / 4;\n for (let i = 0; i < this.personMaskPixelCount; i++) {\n this.tfLite.HEAPF32[inputMemoryOffset + (i * 3)] = imageData.data[i * 4] / 255;\n this.tfLite.HEAPF32[inputMemoryOffset + (i * 3) + 1] = imageData.data[(i * 4) + 1] / 255;\n this.tfLite.HEAPF32[inputMemoryOffset + (i * 3) + 2] = imageData.data[(i * 4) + 2] / 255;\n }\n\n }\n private infer(skipProcessing?: boolean) {\n if(!skipProcessing){\n this.tfLite._runInference();\n }\n const outputMemoryOffset = this.tfLite._getOutputMemoryOffset() / 4;\n\n for (let i = 0; i < this.personMaskPixelCount; i++) {\n if (this.modelName === 'meet') {\n const background = this.tfLite.HEAPF32[outputMemoryOffset + (i * 2)];\n const person = this.tfLite.HEAPF32[outputMemoryOffset + (i * 2) + 1];\n const shift = Math.max(background, person);\n const backgroundExp = Math.exp(background - shift);\n const personExp = Math.exp(person - shift);\n // Sets only the alpha component of each pixel.\n this.personMask.data[(i * 4) + 3] = (255 * personExp) / (backgroundExp + personExp);\n }\n else if (this.modelName === 'landscape-segmentation') {\n const person = this.tfLite.HEAPF32[outputMemoryOffset + i]\n this.personMask.data[i * 4 + 3] = 255 * person\n }\n }\n\n this.personMaskCtx!.putImageData(this.personMask, 0, 0);\n }\n private postProcessing() {\n this.outputCtx!.globalCompositeOperation = 'copy';\n this.outputCtx!.filter = 'none'\n\n if (this.isVirtualBackground ) {\n this.outputCtx!.filter = 'blur(4px)'\n }\n else {\n this.outputCtx!.filter = 'blur(8px)';\n }\n this.drawPersonMask();\n this.outputCtx!.globalCompositeOperation = 'source-in';\n this.outputCtx!.filter = 'none';\n // //Draw the foreground\n this.outputCtx!.drawImage(this.input!, 0, 0);\n\n if (\n this.enableSharpening &&\n this.output!.width > minVideoWidthForSharpening && // minimum and maximum resolution to enable sharpening filter\n this.output!.height > minVideoHeightForSharpening &&\n this.output!.width < maxVideoWidthForSharpening &&\n this.output!.height < maxVideoHeightForSharpening\n ) {\n this.sharpenFilter();\n }\n\n // //Draw the background\n this.drawSegmentedBackground();\n\n }\n\n sharpenFilter(){\n // adding sharpening filter to each frame to improve edges and brightness\n // The basic idea is that you take the weighed sum of a rectangle of pixels from the source image and use that as the output value using convolution filter\n // It is applied intermediate output with black background and only mask data in frame\n // Filter currently used is 3 x 3 sharpening filter with values as shown:\n // [ 0, -1, 0,\n // -1, 5, -1,\n // 0, -1, 0 ]\n let outputImageData = this.outputCtx!.getImageData(\n 0,\n 0,\n this.output!.width,\n this.output!.height\n );\n\n // filters you may try\n // [-1, -1, -1, -1, 9, -1, -1, -1, -1]\n //[0, -1, 0, -1, 5, -1, 0, -1, 0]\n let output = this.filters.convolute(\n outputImageData\n );\n\n this.outputCtx!.putImageData(output, 0, 0);\n }\n\n private drawPersonMask() {\n this.outputCtx!.drawImage(\n this.personMaskCanvas,\n 0,\n 0,\n this.personMaskWidth,\n this.personMaskHeight,\n 0,\n 0,\n this.output!.width,\n this.output!.height\n )\n }\n\n private drawSegmentedBackground() {\n this.outputCtx!.globalCompositeOperation = 'destination-over';\n this.outputCtx!.imageSmoothingEnabled = true;\n this.outputCtx!.imageSmoothingQuality = 'high';\n if (this.isVirtualBackground) {\n this.fitImageToBackground();\n }\n else {\n this.addBlurToBackground();\n }\n }\n\n private async runSegmentation(skipProcessing?: boolean) {\n if (this.tfLite) {\n // const start = performance.now();\n\n this.resizeInputData();\n await this.infer(skipProcessing);\n this.postProcessing();\n // const end = performance.now();\n // this.log(TAG,\"time taken\",end -start);\n }\n }\n\n private fitImageToBackground() {\n let input_width: any, input_height: any, x_offset: any, y_offset: any\n if ((this.backgroundImage!.width / this.backgroundImage!.height) < this.imageAspectRatio) {\n input_width = this.backgroundImage!.width;\n input_height = this.backgroundImage!.width/ this.imageAspectRatio;\n x_offset = 0;\n y_offset = (this.backgroundImage!.height - input_height) / 2;\n }\n else {\n input_height = this.backgroundImage!.height;\n input_width = this.backgroundImage!.height * this.imageAspectRatio;\n y_offset = 0;\n x_offset = (this.backgroundImage!.width - input_width) / 2;\n }\n this.outputCtx!.drawImage(this.backgroundImage!, x_offset, y_offset, input_width, input_height, 0, 0, this.output!.width, this.output!.height);\n }\n\n private async addBlurToBackground(){\n let blurValue = '15px';\n if (this.input!.width <= 160)\n blurValue = '5px';\n else if (this.input!.width <= 320)\n blurValue = '10px';\n else if (this.input!.width <= 640)\n blurValue = '15px';\n else if (this.input!.width <= 960)\n blurValue = '20px';\n else if (this.input!.width <= 1280)\n blurValue = '25px';\n else if(this.input!.width <= 1920)\n blurValue = '30px';\n\n this.outputCtx!.filter = `blur(${blurValue})`;\n this.outputCtx!.drawImage(this.input!, 0, 0, this.output!.width, this.output!.height);\n }\n initSharpenFilter(): any {\n\n this.filters.tmpCanvas = document.createElement('canvas');\n this.filters.tmpCtx = this.filters.tmpCanvas.getContext('2d');\n\n this.filters.createImageData = (w:number, h:number) => {\n return this.filters.tmpCtx.createImageData(w, h);\n };\n\n this.filters.convolute = (\n pixels: ImageData,\n weights = [0, -1, 0, -1, 5, -1, 0, -1, 0],\n opaque: boolean\n ) => {\n var side = Math.round(Math.sqrt(weights.length));\n\n var halfSide = Math.floor(side / 2);\n var src = pixels.data;\n var sw = pixels.width;\n var sh = pixels.height;\n // pad output by the convolution matrix\n var w = sw;\n var h = sh;\n var output = this.filters.createImageData(w, h);\n var dst = output.data;\n // go through the destination image pixels\n var alphaFac = opaque ? 1 : 0;\n for (var y = 0; y < h; y = y + 1) {\n for (var x = 0; x < w; x = x + 1) {\n var dstOff = (y * w + x) * 4;\n\n if (src[dstOff + 3] == 0) {\n continue;\n } else if (x < w && y < h) {\n var sy = y;\n var sx = x;\n\n // calculate the weighed sum of the source image pixels that\n // fall under the convolution matrix\n var r = 0,\n g = 0,\n b = 0,\n a = 0;\n for (var cy = 0; cy < side; cy++) {\n for (var cx = 0; cx < side; cx++) {\n var scy = sy + cy - halfSide;\n var scx = sx + cx - halfSide;\n if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) {\n var srcOff = (scy * sw + scx) * 4;\n var wt = weights[cy * side + cx];\n r += src[srcOff] * wt;\n g += src[srcOff + 1] * wt;\n b += src[srcOff + 2] * wt;\n a += src[srcOff + 3] * wt;\n }\n }\n }\n dst[dstOff] = r;\n dst[dstOff + 1] = g;\n dst[dstOff + 2] = b;\n dst[dstOff + 3] = a + alphaFac * (255 - a);\n }\n }\n }\n return output;\n };\n }\n}"],"names":["runtime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","obj","key","value","defineProperty","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","generator","create","Generator","context","Context","_invoke","state","method","arg","Error","undefined","done","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","type","makeInvokeMethod","fn","call","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","this","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","PromiseImpl","previousPromise","callInvokeWithMethodAndArg","resolve","reject","invoke","result","__await","then","unwrapped","error","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","doneResult","displayName","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","catch","thrown","delegateYield","module","regeneratorRuntime","accidentalStrictMode","globalThis","Function","BASE_URL","require","TAG","loadScript","src","s","document","createElement","onload","onerror","head","appendChild","loadTFLiteModel","path","createTFLiteSIMDModule","tfLite","console","warn","createTFLiteModule","loadTFLite","modelPath","all","fetch","modelResponse","arrayBuffer","model","modelBufferOffset","_getModelBufferMemoryOffset","HEAPU8","set","Uint8Array","_loadModel","byteLength","log","_getInputMemoryOffset","_getInputHeight","_getInputWidth","_getInputChannelCount","pkg","background","enableSharpening","personMaskWidth","personMaskHeight","isVirtualBackground","blurValue","loadModelCalled","modelName","outputCtx","input","output","timerID","imageAspectRatio","personMaskPixelCount","personMask","ImageData","personMaskCanvas","width","height","personMaskCtx","getContext","filters","setBackground","init","tfLitePromise","initSharpenFilter","isSupported","navigator","userAgent","indexOf","getName","getPluginType","HMSVideoPluginType","TRANSFORM","setImage","img","naturalHeight","backgroundImage","removeAttribute","fillStyle","fillRect","processVideoFrame","skipProcessing","ctx","canvas","_this","runSegmentation","process","globalCompositeOperation","filter","drawImage","image","crossOrigin","tag","data","resizeInputData","imageData","getImageData","inputMemoryOffset","HEAPF32","infer","_runInference","outputMemoryOffset","_getOutputMemoryOffset","person","shift","Math","max","backgroundExp","exp","personExp","putImageData","postProcessing","drawPersonMask","sharpenFilter","drawSegmentedBackground","outputImageData","convolute","imageSmoothingEnabled","imageSmoothingQuality","fitImageToBackground","addBlurToBackground","input_width","input_height","x_offset","y_offset","tmpCanvas","tmpCtx","createImageData","w","h","_this2","pixels","weights","opaque","side","round","sqrt","halfSide","floor","sw","sh","dst","alphaFac","y","x","dstOff","sy","sx","r","g","b","a","cy","cx","scy","scx","srcOff","wt"],"mappings":"qeAOA,IAAIA,EAAW,SAAUC,GAGvB,IAAIC,EAAKC,OAAOC,UACZC,EAASH,EAAGI,eAEZC,EAA4B,mBAAXC,OAAwBA,OAAS,GAClDC,EAAiBF,EAAQG,UAAY,aACrCC,EAAsBJ,EAAQK,eAAiB,kBAC/CC,EAAoBN,EAAQO,aAAe,gBAE/C,SAASC,EAAOC,EAAKC,EAAKC,GAOxB,OANAf,OAAOgB,eAAeH,EAAKC,EAAK,CAC9BC,MAAOA,EACPE,YAAY,EACZC,cAAc,EACdC,UAAU,IAELN,EAAIC,GAEb,IAEEF,EAAO,GAAI,IACX,MAAOQ,GACPR,EAAS,SAASC,EAAKC,EAAKC,GAC1B,OAAOF,EAAIC,GAAOC,GAItB,SAASM,EAAKC,EAASC,EAASC,EAAMC,GAEpC,IACIC,EAAY1B,OAAO2B,QADFJ,GAAWA,EAAQtB,qBAAqB2B,EAAYL,EAAUK,GACtC3B,WACzC4B,EAAU,IAAIC,EAAQL,GAAe,IAMzC,OAFAC,EAAUK,QAu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U,EAAI,EAAGA,EAAId,EAAGc,GAAQ,MACxB,IAAIC,EAAI,EAAGA,EAAIhB,EAAGgB,GAAQ,EAAG,KAC5BC,EAAuB,GAAbF,EAAIf,EAAIgB,MAEC,GAAnB5I,EAAI6I,EAAS,IAEND,EAAIhB,GAAKe,EAAId,EAAG,SACrBiB,EAAKH,EACLI,EAAKH,EAILI,EAAI,EACJC,EAAI,EACJC,EAAI,EACJC,EAAI,EACCC,EAAK,EAAGA,EAAKlB,EAAMkB,QACrB,IAAIC,EAAK,EAAGA,EAAKnB,EAAMmB,IAAM,KAC5BC,EAAMR,EAAKM,EAAKf,EAChBkB,EAAMR,EAAKM,EAAKhB,KAChBiB,GAAO,GAAKA,EAAMd,GAAMe,GAAO,GAAKA,EAAMhB,EAAI,KAC5CiB,EAA4B,GAAlBF,EAAMf,EAAKgB,GACrBE,EAAKzB,EAAQoB,EAAKlB,EAAOmB,GAC7BL,GAAKhJ,EAAIwJ,GAAUC,EACnBR,GAAKjJ,EAAIwJ,EAAS,GAAKC,EACvBP,GAAKlJ,EAAIwJ,EAAS,GAAKC,EACvBN,GAAKnJ,EAAIwJ,EAAS,GAAKC,GAI7BhB,EAAII,GAAUG,EACdP,EAAII,EAAS,GAAKI,EAClBR,EAAII,EAAS,GAAKK,EAClBT,EAAII,EAAS,GAAKM,EAAIT,GAAY,IAAMS,WAIvCtG"}
|
|
1
|
+
{"version":3,"file":"hms-virtual-background.cjs.production.min.js","sources":["../node_modules/regenerator-runtime/runtime.js","../src/defineTFLite.ts","../src/HMSVirtualBackgroundPlugin.ts"],"sourcesContent":["/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","const pkg = require(\"../package.json\")\nconst BASE_URL = `https://unpkg.com/${pkg.name}/src`;\nconst TAG = 'VBProcessor';\nconst TFLITE_JS_FILE = 'tflite/tflite.js';\nconst TFLITE_SIMD_JS_FILE = 'tflite/tflite-simd.js';\nconst MODEL_FILE_NAME = 'models/selfie_segmentation_landscape.tflite';\n\nconst loadScript = (src: string) => {\n return new Promise(function (resolve, reject) {\n const s = document.createElement('script');\n s.src = src;\n s.onload = resolve;\n s.onerror = reject;\n document.head.appendChild(s);\n });\n};\n\nconst loadTFLiteModel = async() =>{\n let tfLite: any;\n let path = BASE_URL + \"/\" + TFLITE_SIMD_JS_FILE;\n await loadScript(path);\n try{\n //@ts-ignore\n tfLite = await createTFLiteSIMDModule();\n }catch{\n console.warn('SIMD not supported. You may experience poor virtual background effect.');\n path = BASE_URL + \"/\" + TFLITE_JS_FILE;\n await loadScript(path);\n // @ts-ignore\n tfLite = await createTFLiteModule();\n }\n return tfLite;\n};\n\nconst loadTFLite = async () => {\n const modelPath = BASE_URL + \"/\" + MODEL_FILE_NAME;\n const [tfLite, modelResponse] = await Promise.all([loadTFLiteModel(), fetch(modelPath)]);\n\n const model = await modelResponse.arrayBuffer();\n const modelBufferOffset = tfLite._getModelBufferMemoryOffset();\n tfLite.HEAPU8.set(new Uint8Array(model), modelBufferOffset);\n tfLite._loadModel(model.byteLength);\n\n console.log(TAG,'Input memory offset:', tfLite._getInputMemoryOffset())\n console.log(TAG,'Input height:', tfLite._getInputHeight())\n console.log(TAG,'Input width:', tfLite._getInputWidth())\n console.log(TAG,'Input channels:', tfLite._getInputChannelCount())\n\n return tfLite;\n}\n\nexport { loadTFLite };","import { loadTFLite } from './defineTFLite';\nimport '@tensorflow/tfjs-backend-webgl';\nimport { parseGIF, decompressFrames } from 'gifuct-js';\nimport { HMSVideoPlugin, HMSVideoPluginType } from '@100mslive/hms-video';\n\nconst TAG = 'VBProcessor';\nconst DEFAULT_DELAY = 33;\nconst pkg = require('../package.json');\n\nconst minVideoWidthForSharpening = 214;\nconst maxVideoWidthForSharpening = 855;\nconst minVideoHeightForSharpening = 120;\nconst maxVideoHeightForSharpening = 720;\n\nexport class HMSVirtualBackgroundPlugin implements HMSVideoPlugin {\n background: string | HTMLImageElement;\n personMaskWidth: number;\n personMaskHeight: number;\n isVirtualBackground: boolean;\n backgroundImage: HTMLImageElement | null;\n backgroundVideo: HTMLVideoElement | null;\n backgroundType: string = 'none';\n loadModelCalled: boolean;\n blurValue: any;\n tfLite: any;\n tfLitePromise: any;\n modelName: string;\n\n input: HTMLCanvasElement | null;\n output: HTMLCanvasElement | null;\n outputCtx: CanvasRenderingContext2D | null;\n timerID: number;\n imageAspectRatio: number;\n\n personMaskPixelCount: number;\n personMask: ImageData;\n personMaskCanvas: HTMLCanvasElement;\n personMaskCtx: any;\n filters: any;\n enableSharpening?: boolean | false;\n\n gifFrames: any;\n gifFramesIndex: number;\n gifFrameImageData: any;\n tempGifCanvas: HTMLCanvasElement;\n tempGifContext: any;\n giflocalCount: number;\n\n constructor(background: string, enableSharpening: boolean = false) {\n this.background = background;\n this.enableSharpening = enableSharpening;\n\n this.backgroundImage = null;\n this.backgroundVideo = null;\n\n this.personMaskWidth = 256;\n this.personMaskHeight = 144;\n this.isVirtualBackground = false;\n this.blurValue = '10px';\n this.loadModelCalled = false;\n this.tfLite = null;\n this.modelName = 'landscape-segmentation';\n\n this.outputCtx = null;\n this.input = null;\n this.output = null;\n this.timerID = 0;\n this.imageAspectRatio = 1;\n\n this.personMaskPixelCount = this.personMaskWidth * this.personMaskHeight;\n this.personMask = new ImageData(\n this.personMaskWidth,\n this.personMaskHeight\n );\n this.personMaskCanvas = document.createElement('canvas');\n this.personMaskCanvas.width = this.personMaskWidth;\n this.personMaskCanvas.height = this.personMaskHeight;\n this.personMaskCtx = this.personMaskCanvas.getContext('2d');\n\n this.filters = {};\n this.gifFrames = null;\n this.gifFramesIndex = 0;\n this.gifFrameImageData = null;\n this.tempGifCanvas = document.createElement('canvas');\n this.tempGifContext = this.tempGifCanvas.getContext('2d');\n this.giflocalCount = 0;\n this.enableSharpening = enableSharpening;\n\n this.log(TAG, 'Virtual Background plugin created');\n this.setBackground(this.background);\n }\n\n async init(): Promise<void> {\n if (!this.loadModelCalled) {\n this.log(TAG, 'PREVIOUS LOADED MODEL IS ', this.tfLite);\n this.loadModelCalled = true;\n this.tfLitePromise = loadTFLite();\n this.tfLite = await this.tfLitePromise;\n } else {\n //either it is loading or loaded\n await this.tfLitePromise;\n }\n if (this.enableSharpening) {\n this.initSharpenFilter();\n }\n }\n\n isSupported(): boolean {\n //support chrome, firefox, edge TODO: check this\n return (\n navigator.userAgent.indexOf('Chrome') !== -1 ||\n navigator.userAgent.indexOf('Firefox') !== -1 ||\n navigator.userAgent.indexOf('Edg') !== -1\n );\n }\n\n getName(): string {\n return pkg.name;\n }\n\n getPluginType(): HMSVideoPluginType {\n return HMSVideoPluginType.TRANSFORM;\n }\n\n async setBackground(path?: string | HTMLImageElement | HTMLVideoElement) {\n if (path !== '') {\n if (path === 'none') {\n this.log(TAG, 'setting background to :', path);\n this.background = 'none';\n this.backgroundType = 'none';\n this.isVirtualBackground = false;\n } else if (path === 'blur') {\n this.log(TAG, 'setting background to :', path);\n this.background = 'blur';\n this.backgroundType = 'blur';\n this.isVirtualBackground = false;\n } else if (path instanceof HTMLImageElement) {\n this.log('setting background to image', path);\n const img = await this.setImage(path as HTMLImageElement);\n if (!img || !img.complete || !img.naturalHeight) {\n throw new Error(\n 'Invalid image. Provide a valid and successfully loaded HTMLImageElement'\n );\n } else {\n this.isVirtualBackground = true;\n this.backgroundImage = img;\n this.backgroundType = 'image';\n }\n } else if (path instanceof HTMLVideoElement) {\n this.log('setting background to video', path);\n this.backgroundVideo = path as HTMLVideoElement;\n this.backgroundVideo.crossOrigin = 'anonymous';\n this.backgroundVideo.muted = true;\n this.backgroundVideo.loop = true;\n this.backgroundVideo.oncanplaythrough = async () => {\n if (this.backgroundVideo != null) {\n await this.backgroundVideo!.play();\n this.isVirtualBackground = true;\n this.backgroundType = 'video';\n }\n };\n } else {\n console.log('setting gif to background');\n this.gifFrames = await this.setGiF(path as string);\n if (this.gifFrames != null && this.gifFrames.length > 0) {\n this.backgroundType = 'gif';\n this.isVirtualBackground = true;\n } else {\n throw new Error(\n 'Invalid background supplied, see the docs to check supported background type'\n );\n }\n }\n } else {\n throw new Error(\n 'Invalid background supplied, see the docs to check supported background type'\n );\n }\n }\n\n stop(): void {\n if (this.isVirtualBackground) {\n this.backgroundImage?.removeAttribute('src');\n this.backgroundVideo?.removeAttribute('src');\n if (this.backgroundType === 'video') {\n this.backgroundVideo!.loop = false;\n this.backgroundVideo = null;\n }\n }\n if (this.outputCtx) {\n this.outputCtx!.fillStyle = `rgb(0, 0, 0)`;\n this.outputCtx!.fillRect(0, 0, this.output!.width, this.output!.height);\n }\n\n //gif related\n this.gifFrameImageData = null;\n this.gifFrames = null;\n this.giflocalCount = 0;\n this.gifFramesIndex = 0;\n }\n\n processVideoFrame(\n input: HTMLCanvasElement,\n output: HTMLCanvasElement,\n skipProcessing?: boolean\n ): Promise<void> | void {\n if (!input || !output) {\n throw new Error('Plugin invalid input/output');\n }\n\n this.input = input;\n this.output = output;\n\n const ctx = output.getContext('2d');\n if (ctx!.canvas.width !== input.width) {\n ctx!.canvas.width = input.width;\n }\n if (ctx!.canvas.height !== input.height) {\n ctx!.canvas.height = input.height;\n }\n\n if (this.backgroundType === 'video') {\n this.backgroundVideo!.width = input.width;\n this.backgroundVideo!.height = input.height;\n }\n\n this.outputCtx = ctx!;\n this.imageAspectRatio = input.width / input.height;\n if (this.imageAspectRatio <= 0) {\n throw new Error('Invalid input width/height');\n }\n\n const process = async () => {\n await this.runSegmentation(skipProcessing);\n };\n\n if (this.background === 'none' && !this.isVirtualBackground) {\n this.outputCtx!.globalCompositeOperation = 'copy';\n this.outputCtx!.filter = 'none';\n this.outputCtx!.drawImage(input, 0, 0, input.width, input.height);\n } else {\n process();\n }\n }\n\n private async setImage(image: HTMLImageElement): Promise<any> {\n image.crossOrigin = 'anonymous';\n return new Promise((resolve, reject) => {\n image.onload = () => resolve(image);\n image.onerror = reject;\n });\n }\n\n private setGiF(url: string): Promise<any> {\n return fetch(url)\n .then(resp => resp.arrayBuffer())\n .then(buff => parseGIF(buff))\n .then(gif => {\n return decompressFrames(gif, true);\n });\n }\n\n private log(tag: string, ...data: any[]) {\n console.info(tag, ...data);\n }\n\n private resizeInputData() {\n this.personMaskCtx!.drawImage(\n this.input,\n 0,\n 0,\n this.input!.width,\n this.input!.height,\n 0,\n 0,\n this.personMaskWidth,\n this.personMaskHeight\n );\n\n const imageData = this.personMaskCtx!.getImageData(\n 0,\n 0,\n this.personMaskWidth,\n this.personMaskHeight\n );\n //\n const inputMemoryOffset = this.tfLite._getInputMemoryOffset() / 4;\n for (let i = 0; i < this.personMaskPixelCount; i++) {\n this.tfLite.HEAPF32[inputMemoryOffset + i * 3] =\n imageData.data[i * 4] / 255;\n this.tfLite.HEAPF32[inputMemoryOffset + i * 3 + 1] =\n imageData.data[i * 4 + 1] / 255;\n this.tfLite.HEAPF32[inputMemoryOffset + i * 3 + 2] =\n imageData.data[i * 4 + 2] / 255;\n }\n }\n private infer(skipProcessing?: boolean) {\n if (!skipProcessing) {\n this.tfLite._runInference();\n }\n const outputMemoryOffset = this.tfLite._getOutputMemoryOffset() / 4;\n\n for (let i = 0; i < this.personMaskPixelCount; i++) {\n if (this.modelName === 'meet') {\n const background = this.tfLite.HEAPF32[outputMemoryOffset + i * 2];\n const person = this.tfLite.HEAPF32[outputMemoryOffset + i * 2 + 1];\n const shift = Math.max(background, person);\n const backgroundExp = Math.exp(background - shift);\n const personExp = Math.exp(person - shift);\n // Sets only the alpha component of each pixel.\n this.personMask.data[i * 4 + 3] =\n (255 * personExp) / (backgroundExp + personExp);\n } else if (this.modelName === 'landscape-segmentation') {\n const person = this.tfLite.HEAPF32[outputMemoryOffset + i];\n this.personMask.data[i * 4 + 3] = 255 * person;\n }\n }\n\n this.personMaskCtx!.putImageData(this.personMask, 0, 0);\n }\n\n private postProcessing() {\n this.outputCtx!.globalCompositeOperation = 'copy';\n this.outputCtx!.filter = 'none';\n\n if (this.isVirtualBackground) {\n this.outputCtx!.filter = 'blur(4px)';\n } else {\n this.outputCtx!.filter = 'blur(8px)';\n }\n this.drawPersonMask();\n this.outputCtx!.globalCompositeOperation = 'source-in';\n this.outputCtx!.filter = 'none';\n // //Draw the foreground\n this.outputCtx!.drawImage(this.input!, 0, 0);\n\n if (\n this.enableSharpening &&\n this.output!.width > minVideoWidthForSharpening && // minimum and maximum resolution to enable sharpening filter\n this.output!.height > minVideoHeightForSharpening &&\n this.output!.width < maxVideoWidthForSharpening &&\n this.output!.height < maxVideoHeightForSharpening\n ) {\n this.sharpenFilter();\n }\n\n // //Draw the background\n this.drawSegmentedBackground();\n }\n\n private sharpenFilter() {\n // adding sharpening filter to each frame to improve edges and brightness\n // The basic idea is that you take the weighed sum of a rectangle of pixels from the source image and use that as the output value using convolution filter\n // It is applied intermediate output with black background and only mask data in frame\n // Filter currently used is 3 x 3 sharpening filter with values as shown:\n // [ 0, -1, 0,\n // -1, 5, -1,\n // 0, -1, 0 ]\n let outputImageData = this.outputCtx!.getImageData(\n 0,\n 0,\n this.output!.width,\n this.output!.height\n );\n\n // filters you may try\n // [-1, -1, -1, -1, 9, -1, -1, -1, -1]\n //[0, -1, 0, -1, 5, -1, 0, -1, 0]\n let output = this.filters.convolute(outputImageData);\n\n this.outputCtx!.putImageData(output, 0, 0);\n }\n\n private drawPersonMask() {\n this.outputCtx!.drawImage(\n this.personMaskCanvas,\n 0,\n 0,\n this.personMaskWidth,\n this.personMaskHeight,\n 0,\n 0,\n this.output!.width,\n this.output!.height\n );\n }\n\n private drawSegmentedBackground() {\n this.outputCtx!.globalCompositeOperation = 'destination-over';\n this.outputCtx!.imageSmoothingEnabled = true;\n this.outputCtx!.imageSmoothingQuality = 'high';\n if (this.isVirtualBackground) {\n if (\n this.backgroundType === 'video' &&\n this.backgroundVideo != null &&\n this.backgroundVideo!!.readyState >= 4\n ) {\n this.fitVideoToBackground();\n } else if (this.backgroundType === 'image') {\n this.fitImageToBackground();\n } else if (this.backgroundType === 'gif') {\n if (\n this.giflocalCount >\n this.gifFrames[this.gifFramesIndex].delay / DEFAULT_DELAY\n ) {\n this.gifFramesIndex++;\n if (this.gifFramesIndex >= this.gifFrames.length) {\n this.gifFramesIndex = 0;\n }\n this.giflocalCount = 0;\n } else {\n this.giflocalCount++;\n }\n this.fitGifToBackground();\n }\n } else {\n this.addBlurToBackground();\n }\n }\n\n private async runSegmentation(skipProcessing?: boolean) {\n if (this.tfLite) {\n // const start = performance.now();\n\n this.resizeInputData();\n await this.infer(skipProcessing);\n this.postProcessing();\n // const end = performance.now();\n // this.log(TAG,\"time taken\",end -start);\n }\n }\n\n private fitVideoToBackground() {\n this.fitData(\n this.backgroundVideo,\n this.backgroundVideo!.width,\n this.backgroundVideo!.height\n );\n }\n\n private fitImageToBackground() {\n this.fitData(\n this.backgroundImage,\n this.backgroundImage!.width,\n this.backgroundImage!.height\n );\n }\n\n private fitGifToBackground() {\n if (this.gifFrameImageData == null) {\n var dims = this.gifFrames[this.gifFramesIndex].dims;\n this.tempGifCanvas!.width = dims.width;\n this.tempGifCanvas!.height = dims.height;\n this.gifFrameImageData = this.tempGifContext.createImageData(\n dims.width,\n dims.height\n );\n }\n // set the patch data as an override\n this.gifFrameImageData.data.set(this.gifFrames[this.gifFramesIndex].patch);\n this.tempGifContext.putImageData(this.gifFrameImageData, 0, 0);\n\n this.fitData(\n this.tempGifCanvas,\n this.gifFrameImageData!.width,\n this.gifFrameImageData!.height\n );\n }\n\n private fitData(data: any, dataWidth: number, dataHeight: number) {\n let inputWidth: any, inputHeight: any, xoffset: any, yoffset: any;\n if (dataWidth / dataHeight < this.imageAspectRatio) {\n inputWidth = dataWidth;\n inputHeight = dataWidth / this.imageAspectRatio;\n xoffset = 0;\n yoffset = (dataHeight - inputHeight) / 2;\n } else {\n inputHeight = dataHeight;\n inputWidth = dataHeight * this.imageAspectRatio;\n yoffset = 0;\n xoffset = (dataWidth - inputWidth) / 2;\n }\n this.outputCtx!.drawImage(\n data,\n xoffset,\n yoffset,\n inputWidth,\n inputHeight,\n 0,\n 0,\n this.output!.width,\n this.output!.height\n );\n }\n\n private async addBlurToBackground() {\n let blurValue = '15px';\n if (this.input!.width <= 160) blurValue = '5px';\n else if (this.input!.width <= 320) blurValue = '10px';\n else if (this.input!.width <= 640) blurValue = '15px';\n else if (this.input!.width <= 960) blurValue = '20px';\n else if (this.input!.width <= 1280) blurValue = '25px';\n else if (this.input!.width <= 1920) blurValue = '30px';\n\n this.outputCtx!.filter = `blur(${blurValue})`;\n this.outputCtx!.drawImage(\n this.input!,\n 0,\n 0,\n this.output!.width,\n this.output!.height\n );\n }\n\n private initSharpenFilter(): any {\n this.filters.tmpCanvas = document.createElement('canvas');\n this.filters.tmpCtx = this.filters.tmpCanvas.getContext('2d');\n\n this.filters.createImageData = (w: number, h: number) => {\n return this.filters.tmpCtx.createImageData(w, h);\n };\n\n this.filters.convolute = (\n pixels: ImageData,\n weights = [0, -1, 0, -1, 5, -1, 0, -1, 0],\n opaque: boolean\n ) => {\n var side = Math.round(Math.sqrt(weights.length));\n\n var halfSide = Math.floor(side / 2);\n var src = pixels.data;\n var sw = pixels.width;\n var sh = pixels.height;\n // pad output by the convolution matrix\n var w = sw;\n var h = sh;\n var output = this.filters.createImageData(w, h);\n var dst = output.data;\n // go through the destination image pixels\n var alphaFac = opaque ? 1 : 0;\n for (var y = 0; y < h; y = y + 1) {\n for (var x = 0; x < w; x = x + 1) {\n var dstOff = (y * w + x) * 4;\n\n if (src[dstOff + 3] === 0) {\n continue;\n } else if (x < w && y < h) {\n var sy = y;\n var sx = x;\n\n // calculate the weighed sum of the source image pixels that\n // fall under the convolution matrix\n var r = 0,\n g = 0,\n b = 0,\n a = 0;\n for (var cy = 0; cy < side; cy++) {\n for (var cx = 0; cx < side; cx++) {\n var scy = sy + cy - halfSide;\n var scx = sx + cx - halfSide;\n if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) {\n var srcOff = (scy * sw + scx) * 4;\n var wt = weights[cy * side + cx];\n r += src[srcOff] * wt;\n g += src[srcOff + 1] * wt;\n b += src[srcOff + 2] * wt;\n a += src[srcOff + 3] * wt;\n }\n }\n }\n dst[dstOff] = r;\n dst[dstOff + 1] = g;\n dst[dstOff + 2] = b;\n dst[dstOff + 3] = a + alphaFac * (255 - a);\n }\n }\n }\n return output;\n };\n }\n}\n"],"names":["runtime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","obj","key","value","defineProperty","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","generator","create","Generator","context","Context","_invoke","state","method","arg","Error","undefined","done","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","type","makeInvokeMethod","fn","call","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","this","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","PromiseImpl","previousPromise","callInvokeWithMethodAndArg","resolve","reject","invoke","result","__await","then","unwrapped","error","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","doneResult","displayName","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","catch","thrown","delegateYield","module","regeneratorRuntime","accidentalStrictMode","globalThis","Function","BASE_URL","require","TAG","loadScript","src","s","document","createElement","onload","onerror","head","appendChild","loadTFLiteModel","path","createTFLiteSIMDModule","tfLite","console","warn","createTFLiteModule","loadTFLite","modelPath","all","fetch","modelResponse","arrayBuffer","model","modelBufferOffset","_getModelBufferMemoryOffset","HEAPU8","set","Uint8Array","_loadModel","byteLength","log","_getInputMemoryOffset","_getInputHeight","_getInputWidth","_getInputChannelCount","pkg","background","enableSharpening","backgroundImage","backgroundVideo","personMaskWidth","personMaskHeight","isVirtualBackground","blurValue","loadModelCalled","modelName","outputCtx","input","output","timerID","imageAspectRatio","personMaskPixelCount","personMask","ImageData","personMaskCanvas","width","height","personMaskCtx","getContext","filters","gifFrames","gifFramesIndex","gifFrameImageData","tempGifCanvas","tempGifContext","giflocalCount","setBackground","init","tfLitePromise","initSharpenFilter","isSupported","navigator","userAgent","indexOf","getName","getPluginType","HMSVideoPluginType","TRANSFORM","backgroundType","HTMLImageElement","setImage","img","naturalHeight","HTMLVideoElement","crossOrigin","muted","loop","oncanplaythrough","_this","play","setGiF","removeAttribute","fillStyle","fillRect","processVideoFrame","skipProcessing","ctx","canvas","_this2","runSegmentation","process","globalCompositeOperation","filter","drawImage","image","url","resp","buff","parseGIF","gif","decompressFrames","tag","data","resizeInputData","imageData","getImageData","inputMemoryOffset","HEAPF32","infer","_runInference","outputMemoryOffset","_getOutputMemoryOffset","person","shift","Math","max","backgroundExp","exp","personExp","putImageData","postProcessing","drawPersonMask","sharpenFilter","drawSegmentedBackground","outputImageData","convolute","imageSmoothingEnabled","imageSmoothingQuality","readyState","fitVideoToBackground","fitImageToBackground","delay","fitGifToBackground","addBlurToBackground","fitData","dims","createImageData","patch","dataWidth","dataHeight","inputWidth","inputHeight","xoffset","yoffset","tmpCanvas","tmpCtx","w","h","_this3","pixels","weights","opaque","side","round","sqrt","halfSide","floor","sw","sh","dst","alphaFac","y","x","dstOff","sy","sx","r","g","b","a","cy","cx","scy","scx","srcOff","wt"],"mappings":"4fAOA,IAAIA,EAAW,SAAUC,GAGvB,IAAIC,EAAKC,OAAOC,UACZC,EAASH,EAAGI,eAEZC,EAA4B,mBAAXC,OAAwBA,OAAS,GAClDC,EAAiBF,EAAQG,UAAY,aACrCC,EAAsBJ,EAAQK,eAAiB,kBAC/CC,EAAoBN,EAAQO,aAAe,gBAE/C,SAASC,EAAOC,EAAKC,EAAKC,GAOxB,OANAf,OAAOgB,eAAeH,EAAKC,EAAK,CAC9BC,M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