Esempio n. 1
0
    /**
     * Render videos from various video portals
     *
     * @param \GeorgRinger\News\Domain\Model\Media $element
     * @param integer $width
     * @param integer $height
     * @return string
     */
    public function render(\GeorgRinger\News\Domain\Model\Media $element, $width, $height)
    {
        $content = $finalUrl = '';
        $url = FileService::getCorrectUrl($element->getContent());
        // get the correct rewritten url
        $mediaWizard = \TYPO3\CMS\Frontend\MediaWizard\MediaWizardProviderManager::getValidMediaWizardProvider($url);
        if ($mediaWizard !== NULL) {
            $finalUrl = $mediaWizard->rewriteUrl($url);
        }
        // override width & height if both are set
        if ($element->getWidth() > 0 && $element->getHeight() > 0) {
            $width = $element->getWidth();
            $height = $element->getHeight();
        }
        if (!empty($finalUrl)) {
            $GLOBALS['TSFE']->getPageRenderer()->addJsFile('typo3conf/ext/news/Resources/Public/JavaScript/Contrib/swfobject-2-2.js');
            $uniqueDivId = 'mediaelement' . FileService::getUniqueId($element);
            $content .= '<div id="' . htmlspecialchars($uniqueDivId) . '"></div>
						<script type="text/javascript">
							var params = { allowScriptAccess: "always", allowfullscreen : "true" };
							var atts = { id: ' . GeneralUtility::quoteJSvalue($uniqueDivId) . ' };
							swfobject.embedSWF(' . GeneralUtility::quoteJSvalue($finalUrl) . ',
							' . GeneralUtility::quoteJSvalue($uniqueDivId) . ', "' . (int) $width . '", "' . (int) $height . '", "8", null, null, params, atts);
						</script>';
        }
        return $content;
    }
Esempio n. 2
0
 /**
  * Render mp3 files
  *
  * @param \GeorgRinger\News\Domain\Model\Media $element
  * @param integer $width
  * @param integer $height
  * @param string $template
  * @return string
  */
 public function render(\GeorgRinger\News\Domain\Model\Media $element, $width, $height, $template = '')
 {
     $url = FileService::getCorrectUrl($element->getMultimedia());
     $uniqueId = FileService::getUniqueId($element);
     $GLOBALS['TSFE']->getPageRenderer()->addJsFile(self::PATH_TO_JS . 'audio.min.js');
     $inlineJs = 'audiojs.events.ready(function() { audiojs.createAll(); });';
     $GLOBALS['TSFE']->getPageRenderer()->addJsInlineCode('news_audio_html5', $inlineJs);
     $content = '<audio src="' . htmlspecialchars($url) . '" preload="auto"></audio>';
     return $content;
 }
Esempio n. 3
0
File: Mp3.php Progetto: r3h6/news
    /**
     * Render mp3 files
     *
     * @param \GeorgRinger\News\Domain\Model\Media $element
     * @param integer $width
     * @param integer $height
     * @param string $template
     * @return string
     */
    public function render(\GeorgRinger\News\Domain\Model\Media $element, $width, $height, $template = '')
    {
        $url = FileService::getCorrectUrl($element->getMultimedia());
        $uniqueId = FileService::getUniqueId($element);
        $GLOBALS['TSFE']->getPageRenderer()->addJsFile(self::PATH_TO_JS . 'swfobject-2-2.js');
        $GLOBALS['TSFE']->getPageRenderer()->addJsFile(self::PATH_TO_JS . 'audioplayer-noswfobject.js');
        $inlineJs = '
			AudioPlayer.setup("' . GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . self::PATH_TO_JS . 'audioplayer-player.swf", {
				width: ' . (int) $width . '
			});';
        $GLOBALS['TSFE']->getPageRenderer()->addJsInlineCode('news_audio', $inlineJs);
        $content = '<p id="' . htmlspecialchars($uniqueId) . '">' . htmlspecialchars($element->getCaption()) . '</p>
					<script type="text/javascript">
						AudioPlayer.embed(' . GeneralUtility::quoteJSvalue($uniqueId) . ', {soundFile: ' . GeneralUtility::quoteJSvalue($url) . '});
					</script> ';
        return $content;
    }
Esempio n. 4
0
File: File.php Progetto: r3h6/news
 /**
  * Render a video player
  *
  * @param \GeorgRinger\News\Domain\Model\Media $element
  * @param integer $width
  * @param integer $height
  * @param string $templateFile template file to override. Absolute path
  * @return string
  */
 public function render(\GeorgRinger\News\Domain\Model\Media $element, $width, $height, $templateFile = '')
 {
     $view = GeneralUtility::makeInstance('Tx_Fluid_View_StandaloneView');
     if (!$templateFile || !is_readable($templateFile)) {
         $view->setTemplatePathAndFilename(ExtensionManagementUtility::extPath('news') . 'Resources/Private/Templates/ViewHelpers/Flv.html');
     } else {
         $view->setTemplatePathAndFilename($templateFile);
     }
     $url = FileService::getCorrectUrl($element->getContent());
     $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', MathUtility::convertToPositiveInteger($width));
     $view->assign('height', MathUtility::convertToPositiveInteger($height));
     $view->assign('uniqueDivId', 'mediaelement-' . FileService::getUniqueId($element));
     $view->assign('url', $url);
     return $view->render();
 }