[SOLVED] Display TCA fields for specific video file type (TYPO3 v12.4)

Adding an option to add panopto videos via the “Add media by URL” button inside the “Text & Media” element.
My new PanoptoHelper is working. However i am struggeling to get the fields displayed for only panopto files. Here is what i have done:

$GLOBALS['TCA']['tt_content']['columns']['assets']['config']['overrideChildTca']['types']['panopto'] = [
    'showitem' => '
        --palette--;;videoOverlayPalette,
        --palette--;;filePalette,
        --palette--;;panoptoMode,
        --palette--;;panoptoOptions'
];

The above is not working. But this is:

$GLOBALS['TCA']['tt_content']['columns']['assets']['config']['overrideChildTca']['types'][\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO]['showitem'] .= '--palette--;;panoptoMode,--palette--;;panoptoOptions';

This will however display the fields for all video files (also youtube and vimeo).
Perhaps i am missing something in my ext_localconf.php?

// Register the Panopto online media helper
$GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['onlineMediaHelpers']['panopto'] = \Aarhus\Panopto\Resource\OnlineMedia\Helpers\PanoptoHelper::class;

// Register the Panopto renderer
$rendererRegistry = GeneralUtility::makeInstance(RendererRegistry::class);
$rendererRegistry->registerRendererClass(PanoptoRenderer::class);

// Register panopto file extension
$GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext'] .= ',panopto';

// Register a custom mime-type for the panopto file extension
$GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['mimeTypeCompatibility']['text/plain']['panopto'] = 'video/panopto';

I am working on a TYPO3 v12.4 installation.

Any suggestions?

Hi @antonbrixtoro!

I think this is caused by the mime type starting with “video”.

TYPO3 uses the first part of the mime type to detect the file type, so a mime type “video/panopto” will be classified as a video file and be handled the same. I don’t think there’s a good way to make one particular video format handle itself differently.

Here’s the lines affecting you in TYPO3 v12.4:

Hi @antonbrixtoro!

Just checking in to see if my answer was of help to you or if you found another solution to the issue.

Hi Mathias,

Thanks for your reply, and sorry for the delay in getting back to you.

You are right that keeping the MIME type starting with video causes TYPO3 to classify Panopto files as standard videos. However, keeping the video part of the MIME type had some advantages for my use case: it ensured that Panopto files were still treated as videos in various parts of the system, without me having to extend more TYPO3 core classes. For example, in the backend file list they would appear consistently alongside other video files.

My solution was to explicitly enforce both the type (integer) and the MIME type in the sys_file table using the FileIndexRepository from my custom PanoptoHelper class:

// Set the correct type and mimetype locally on the File object
$file->updateProperties([
    'type' => PanoptoFileInfo::FILETYPE_PANOPTO,
    'mime_type' => PanoptoFileInfo::MIMETYPE_PANOPTO,
]);

// ... and then persist them to sys_file
$fileIndexRepository = parent::getFileIndexRepository();
$fileIndexRepository->update($file);

For frontend rendering, I also implemented a custom PanoptoRenderer and provided an override of the Type.html template from fluid_styled_content.

This approach gives me the flexibility to treat Panopto files as a special case, while still leveraging TYPO3’s built-in handling of video files where it makes sense.

That looks like a great solution! Thanks for posting it. :grinning: