media-stream-player
Version:
Player built on top of media-stream-library
15 lines • 627 B
JavaScript
export const getImageURL = (el, { width, height }) => {
var _a;
const canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
/**
* This has been tested and works on Chrome and Firefox.
* Might not work on some versions of MS Edge and IE.
*
* 2020-07-15
*/
(_a = canvas === null || canvas === void 0 ? void 0 : canvas.getContext('2d')) === null || _a === void 0 ? void 0 : _a.drawImage(el, 0, 0, width, height);
return canvas === null || canvas === void 0 ? void 0 : canvas.toDataURL('image/jpeg');
};
//# sourceMappingURL=GetImageURL.js.map