Esempio n. 1
0
 /**
  * Render a video player
  *
  * @param Tx_News_Domain_Model_FileReference $element
  * @param integer $width
  * @param integer $height
  * @param string $templateFile template file to override. Absolute path
  * @return string
  */
 public function render(Tx_News_Domain_Model_FileReference $element, $width, $height, $templateFile = '')
 {
     $view = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Fluid_View_StandaloneView');
     if (!$templateFile || !is_readable($templateFile)) {
         $view->setTemplatePathAndFilename(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('news') . 'Resources/Private/Templates/ViewHelpers/Flv.html');
     } else {
         $view->setTemplatePathAndFilename($templateFile);
     }
     $GLOBALS['TSFE']->getPageRenderer()->addJsFile(self::PATH_TO_JS . 'flowplayer-3.2.12.min.js');
     // override width & height if both are set
     if ($element->getWidth() > 0 && $element->getHeight() > 0) {
         $width = $element->getWidth();
         $height = $element->getHeight();
     }
     $view->assign('width', \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($width));
     $view->assign('height', \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($height));
     $view->assign('uniqueDivId', 'mediaelement-' . md5($element->getUid() . uniqid()));
     $view->assign('url', $element->getOriginalResource()->getPublicUrl());
     return $view->render();
 }