/**
     * Render videos from various video portals
     *
     * @param Tx_News_Domain_Model_Media $element
     * @param integer $width
     * @param integer $height
     * @return string
     */
    public function render(Tx_News_Domain_Model_Media $element, $width, $height)
    {
        $content = $finalUrl = '';
        $url = Tx_News_Service_FileService::getCorrectUrl($element->getContent());
        // get the correct rewritten url
        $mediaWizard = tslib_mediaWizardManager::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' . md5($element->getUid() . uniqid());
            $content .= '<div id="' . $uniqueDivId . '"></div>
						<script type="text/javascript">
							var params = { allowScriptAccess: "always" };
							var atts = { id: "' . $uniqueDivId . '" };
							swfobject.embedSWF("' . htmlspecialchars($finalUrl) . '",
							"' . $uniqueDivId . '", "' . (int) $width . '", "' . (int) $height . '", "8", null, null, params, atts);
						</script>';
        }
        return $content;
    }
Example #2
0
 /**
  * Videosites implementation is always enabled if any file given,
  * the check is done in tslib_mediaWizardManager
  *
  * @param Tx_News_Domain_Model_Media $element
  * @return boolean
  */
 public function enabled(Tx_News_Domain_Model_Media $element)
 {
     $result = TRUE;
     $file = $element->getContent();
     if (empty($file)) {
         $result = FALSE;
     }
     return $result;
 }
Example #3
0
 /**
  * @param Tx_News_Domain_Model_Media $element
  * @return null|string
  */
 public function getYoutubeUrl(Tx_News_Domain_Model_Media $element)
 {
     $videoId = NULL;
     $youtubeUrl = NULL;
     if (preg_match('/(v=|v\\/|.be\\/)([^(\\&|$)]*)/', $element->getContent(), $matches)) {
         $videoId = $matches[2];
     }
     if ($videoId) {
         $youtubeUrl = 'http://www.youtube.com/embed/' . $videoId . '?fs=1&wmode=opaque';
     }
     return $youtubeUrl;
 }
Example #4
0
 /**
  * Get Vimeo url
  *
  * @param Tx_News_Domain_Model_Media $element
  * @return null|string
  */
 public function getVimeoUrl(Tx_News_Domain_Model_Media $element)
 {
     $videoId = NULL;
     $vimeoUrl = NULL;
     if (preg_match('/vimeo.com\\/([0-9]+)/', $element->getContent(), $matches)) {
         $videoId = $matches[1];
     }
     if ($videoId) {
         $vimeoUrl = '//player.vimeo.com/video/' . $videoId . '';
     }
     return $vimeoUrl;
 }
    /**
     * Render flv viles
     *
     * @param Tx_News_Domain_Model_Media $element
     * @param integer $width
     * @param integer $height
     * @return string
     */
    public function render(Tx_News_Domain_Model_Media $element, $width, $height)
    {
        $url = Tx_News_Service_FileService::getCorrectUrl($element->getContent());
        $url = htmlspecialchars($url);
        $width = (int) $width;
        $height = (int) $height;
        // override width & height if both are set
        if ($element->getWidth() > 0 && $element->getHeight() > 0) {
            $width = $element->getWidth();
            $height = $element->getHeight();
        }
        $content = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="' . $width . '" height="' . $height . '" >
					<param name="src" value="' . $url . '">
					<param name="autoplay" value="true">
					<param name="type" value="video/quicktime" width="' . $width . '" height="' . $height . '">
					<embed src="' . $url . '" width="' . $width . '" height="' . $height . '" autoplay="false" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/">
				</object>';
        return $content;
    }
Example #6
0
 /**
  * Render a video player
  *
  * @param Tx_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(Tx_News_Domain_Model_Media $element, $width, $height, $templateFile = '')
 {
     $view = t3lib_div::makeInstance('Tx_Fluid_View_StandaloneView');
     if (!$templateFile || !is_readable($templateFile)) {
         $view->setTemplatePathAndFilename(t3lib_extMgm::extPath('news') . 'Resources/Private/Templates/ViewHelpers/Flv.html');
     } else {
         $view->setTemplatePathAndFilename($templateFile);
     }
     $url = Tx_News_Service_FileService::getCorrectUrl($element->getContent());
     $GLOBALS['TSFE']->getPageRenderer()->addJsFile(self::PATH_TO_JS . 'flowplayer-3.2.4.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', Tx_News_Utility_Compatibility::convertToPositiveInteger($width));
     $view->assign('height', Tx_News_Utility_Compatibility::convertToPositiveInteger($height));
     $view->assign('uniqueDivId', 'mediaelement-' . Tx_News_Service_FileService::getUniqueId($element));
     $view->assign('url', $url);
     return $view->render();
 }
 /**
  * Implementation is used if file extension is mov
  *
  * @param Tx_News_Domain_Model_Media $element
  * @return boolean
  */
 public function enabled(Tx_News_Domain_Model_Media $element)
 {
     $url = $element->getContent();
     $fileEnding = strtolower(substr($url, -3));
     return $fileEnding === 'mov';
 }
Example #8
0
 /**
  * Implementation is only used if file ending is mp3
  *
  * @param Tx_News_Domain_Model_Media $element media element
  * @return boolean
  */
 public function enabled(Tx_News_Domain_Model_Media $element)
 {
     $url = Tx_News_Service_FileService::getFalFilename($element->getContent());
     $fileEnding = strtolower(substr($url, -3));
     return $fileEnding === 'mp3';
 }