[FEATURE] Video player in backend (i) window 16/32816/8
authorFelix Kopp <felix-source@phorax.com>
Tue, 16 Sep 2014 23:23:35 +0000 (01:23 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Mon, 27 Oct 2014 14:06:11 +0000 (15:06 +0100)
Allow video and audio playback in the backend (i) element
information window.

Uses the new introduced RenderingRegistry to find a matching
rendering class (#61800).

Brings default letter box background color for <Video> tags.

Resolves: #61668
Releases: master
Change-Id: I7c01fbaf2258b4e7c6f10da0e6438bdc55d12197
Reviewed-on: http://review.typo3.org/32816
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/backend/Classes/Controller/ContentElement/ElementInformationController.php
typo3/sysext/core/Documentation/Changelog/master/Feature-61668-VideoAndAudioPlayerInBackendRecordInformationWindow.rst [new file with mode: 0644]
typo3/sysext/t3skin/Resources/Private/Styles/TYPO3/_main_content.less
typo3/sysext/t3skin/Resources/Public/Css/visual/t3kin.css

index 949c662..839790f 100644 (file)
@@ -241,38 +241,52 @@ class ElementInformationController {
                if (!$this->fileObject) {
                        return;
                }
-               $imageTag = '';
+
+               $previewTag = '';
                $downloadLink = '';
 
                // check if file is marked as missing
                if ($this->fileObject->isMissing()) {
                        $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($this->fileObject);
-                       $imageTag .= $flashMessage->render();
+                       $previewTag .= $flashMessage->render();
 
                } else {
 
+                       /** @var \TYPO3\CMS\Core\Resource\Rendering\RendererRegistry $rendererRegistry */
+                       $rendererRegistry = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Rendering\\RendererRegistry');
+                       $fileRenderer = $rendererRegistry->getRenderer($this->fileObject);
                        $fileExtension = $this->fileObject->getExtension();
-                       $thumbUrl = '';
-                       if (GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileExtension)) {
+                       $url = $this->fileObject->getPublicUrl(TRUE);
+
+                       // Check if there is a FileRenderer
+                       if ($fileRenderer !== NULL) {
+                               $previewTag = $fileRenderer->render(
+                                       $this->fileObject,
+                                       '590m',
+                                       '400m',
+                                       array(),
+                                       TRUE
+                               );
+
+                       // else check if we can create an Image preview
+                       } elseif (GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileExtension)) {
                                $thumbUrl = $this->fileObject->process(
                                        ProcessedFile::CONTEXT_IMAGEPREVIEW,
                                        array(
-                                               'width' => '400m',
+                                               'width' => '590m',
                                                'height' => '400m'
                                        )
                                )->getPublicUrl(TRUE);
-                       }
 
-                       // Create thumbnail image?
-                       if ($thumbUrl) {
-                               $imageTag .= '<img src="' . $thumbUrl . '" ' .
+                               // Create thumbnail image?
+                               if ($thumbUrl) {
+                                       $previewTag .= '<img src="' . $thumbUrl . '" ' .
                                                'alt="' . htmlspecialchars(trim($this->fileObject->getName())) . '" ' .
                                                'title="' . htmlspecialchars(trim($this->fileObject->getName())) . '" />';
+                               }
                        }
 
-                       // Display download link?
-                       $url = $this->fileObject->getPublicUrl(TRUE);
-
+                       // Download
                        if ($url) {
                                $downloadLink .= '<a href="' . htmlspecialchars($url) . '" target="_blank" class="t3-button">' .
                                                IconUtility::getSpriteIcon('actions-edit-download') . ' ' .
@@ -281,7 +295,7 @@ class ElementInformationController {
                        }
                }
 
-               return ($imageTag ? '<p>' . $imageTag . '</p>' : '') .
+               return ($previewTag ? '<p>' . $previewTag . '</p>' : '') .
                                ($downloadLink ? '<p>' . $downloadLink . '</p>' : '');
        }
 
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-61668-VideoAndAudioPlayerInBackendRecordInformationWindow.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-61668-VideoAndAudioPlayerInBackendRecordInformationWindow.rst
new file mode 100644 (file)
index 0000000..3953041
--- /dev/null
@@ -0,0 +1,15 @@
+========================================================================
+Feature: #61668 - Video and audio playback in backend record information
+========================================================================
+
+Description
+===========
+
+The record information popup ("i" symbol) can play certain html5 video and audio
+types. This is especially useful in the "file list" module.
+
+
+Impact
+======
+
+Better usability of media files.
\ No newline at end of file
index d0817ee..8eb7d8f 100644 (file)
@@ -66,6 +66,10 @@ a span {
        cursor: pointer;
 }
 
+video {
+       background-color: #000;
+}
+
 /* - - - - - - - - - - - - - - - - - - - - -
 Various classes
 - - - - - - - - - - - - - - - - - - - - - */
@@ -204,4 +208,4 @@ span.warningboxheader {
 /* all buttons have the "click" mouse cursor */
 .t3-btn {
        cursor: pointer;
-}
\ No newline at end of file
+}
index 2fd35b6..e62ecf0 100644 (file)
@@ -9964,6 +9964,9 @@ li.divider {
 a span {
   cursor: pointer;
 }
+video {
+  background-color: #000;
+}
 /* - - - - - - - - - - - - - - - - - - - - -
 Various classes
 - - - - - - - - - - - - - - - - - - - - - */