diff --git a/client/ayon_core/lib/transcoding.py b/client/ayon_core/lib/transcoding.py index b3958863fe..dd44d4a673 100644 --- a/client/ayon_core/lib/transcoding.py +++ b/client/ayon_core/lib/transcoding.py @@ -1519,12 +1519,24 @@ def get_media_mime_type(filepath: str) -> Optional[str]: Optional[str]: Mime type or None if is unknown mime type. """ + try: + from ayon_api.utils import ( + get_media_mime_type_for_content as _ayon_api_func + ) + except ImportError: + _ayon_api_func = None + if not filepath or not os.path.exists(filepath): return None with open(filepath, "rb") as stream: content = stream.read() + if _ayon_api_func is not None: + mime_type = _ayon_api_func(content) + if mime_type is not None: + return mime_type + content_len = len(content) # Pre-validation (largest definition check) # - hopefully there cannot be media defined in less than 12 bytes