mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 11:22:31 +00:00
* fix(face-landmarks): stop recognition when imageCapture error * ref(face-landmarks): convert files in typescript fix: lint issues * code review * ref(face-landmarks): move detection part to a class * ref(face-landmarks): make FaceLandmarksDetector singleton * fix typo and ts-ignore problematic types * fix linting issues
32 lines
883 B
TypeScript
32 lines
883 B
TypeScript
/*
|
|
* Safari < 15 polyfill for createImageBitmap
|
|
* https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap
|
|
*
|
|
* Support source image types: Canvas.
|
|
*/
|
|
// @ts-nocheck
|
|
if (!('createImageBitmap' in window)) {
|
|
window.createImageBitmap = async function(data) {
|
|
return new Promise((resolve, reject) => {
|
|
let dataURL;
|
|
|
|
if (data instanceof HTMLCanvasElement) {
|
|
dataURL = data.toDataURL();
|
|
} else {
|
|
reject(new Error('createImageBitmap does not handle the provided image source type'));
|
|
}
|
|
const img = document.createElement('img');
|
|
|
|
img.close = () => {
|
|
// empty
|
|
};
|
|
|
|
img.addEventListener('load', () => {
|
|
resolve(img);
|
|
});
|
|
|
|
img.src = dataURL;
|
|
});
|
|
};
|
|
}
|