_getSourceType(source) {
        let sourceType;

        if(typeof source === "string") {
            // from https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#Supported_image_formats
            if(source.match(/\.(jpeg|jpg|jfif|pjpeg|pjp|gif|bmp|png|webp|svg|avif|apng)$/) !== null) {
                sourceType = "image";
            }
            else if(source.match(/\.(webm|mp4|mpg|mpeg|avi|ogg|ogm|ogv|mov|av1)$/) !== null) {
                sourceType = "video";
            }
        }
        else {
            if(source.tagName.toUpperCase() === "IMG") {
                sourceType = "image";
            }
            else if(source.tagName.toUpperCase() === "VIDEO") {
                sourceType = "video";
            }
            else if(source.tagName.toUpperCase() === "CANVAS") {
                sourceType = "canvas";
            }
        }

        return sourceType;
    }
Get the source type based on its file extension if it's a string or it's tag name if its a HTML element

     params:
     @source (html element or string): html image, video, canvas element or source url

     returns :
     @sourceType (string): either "image", "video", "canvas" or null if source type cannot be determined
*