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:
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.
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.