From cb038a49c417813bbb09f770e49aa28169a83710 Mon Sep 17 00:00:00 2001 From: Rory& Date: Tue, 2 Jul 2024 02:00:43 +0200 Subject: Authenticated media foundations --- MatrixUtils.Web/wwwroot/index.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'MatrixUtils.Web/wwwroot/index.html') diff --git a/MatrixUtils.Web/wwwroot/index.html b/MatrixUtils.Web/wwwroot/index.html index 5182193..7425de2 100644 --- a/MatrixUtils.Web/wwwroot/index.html +++ b/MatrixUtils.Web/wwwroot/index.html @@ -57,6 +57,22 @@ height: window.innerHeight }; } + + setImageStream = async (element, imageStream) => { + if(!(element instanceof HTMLElement)) { + console.error("Element is not an HTMLElement", element); + return; + } + + const arrayBuffer = await imageStream.arrayBuffer(); + const blob = new Blob([arrayBuffer]); + const url = URL.createObjectURL(blob); + const image = document.getElementById(imageElementId); + image.onload = () => { + URL.revokeObjectURL(url); + } + image.src = url; + } -- cgit 1.5.1