#106436Allow additional video/audio/text/application formats for FileType ENUM
Description
Some MIME types are marked like “application/dash+xml” and “application/vnd.apple.mpegurl” and allow videostreaming formats.
This cannot properly be evaluated by the TYPO3 Core because it currently “listens” only for “video/” MIME types to show a video palette in the Backend. For the frontend, only very specific “video/…” formats evaluated by the MediaViewHelper / VideoTagRenderer will be returned.
By using:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['fileExtensionToMimeType']['mpd'] = 'video/mp4'; $GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['fileExtensionToMimeType']['hls'] = 'video/mp4';
you can actually remap mime types to get the party started in the backend, and then files uploaded with this filename will receive a ‘video/mp4’ sys_file.mimetype entry.
This falls apart for the MediaViewHelper/VideoTagRenderer though, because it would then receive ‘video/mp4’ and use that for <source type="video/mp4"> frontend output.
A middleware could do string replacements later on, or with custom ViewHelpers and Partials, integrators could solve this.
But there should be a possiblity for the TYPO3 core to make this easier for integrators.
I suggest we create a new settings.php directive like:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['additionalFileTypeMapping']['text'] = ''; $GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['additionalFileTypeMapping']['image'] = ''; $GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['additionalFileTypeMapping']['audio'] = ''; $GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['additionalFileTypeMapping']['video'] = 'mpd,hls'; $GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['additionalFileTypeMapping']['application'] = '';
Then, instead of fake-mapping a MIME-Type, this could happen:
- A new
TYPO3\CMS\Core\Resource\FileType::tryFromMimeTypeAndFilename()needs to be created, to also contain the file NAME (not only mime type). - This new method needs to be used instead of current places in the code for
tryFromMimeTypewhere needed (for now, mainly inAbstractFile). TYPO3\CMS\Core\Resource\FileType::tryFromMimeTypeAndFilename()evaluates this config option and not only matches to the base MIME type, but also inspects the filename to report the proper FileType ENUM- The f:media VH and the AudioTagRender / VideoTagRenderer / AudioTagRenderer would need to be changed to no longer do MIME type (via property
$possibleMimeTypes) detection, but instead utilize the FileType ENUM too (maybe on top of a custom MIME type list?)
Configuring the $GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['additionalFileTypeMapping'] arrays is currently not possible in the TYPO3 Core Settings GUI, so it would need to be file-based. In the future, managing these arrays within the GUI is covered by other feature requests. ;)
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Fix this issue
Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch
- Commit message
-
[FEATURE] Allow additional video/audio/text/application formats for FileType ENUM Resolves: #106436 Releases: main