/** * Files with extension flv|mp4 are handled within this implementation * * @param \GeorgRinger\News\Domain\Model\Media $element * @return bool */ public function enabled(\GeorgRinger\News\Domain\Model\Media $element) { $url = FileService::getFalFilename($element->getMultimedia()); $fileEnding = strtolower(substr($url, -3)); $enabled = false; if ($fileEnding === 'flv' || $fileEnding === 'mp4') { $enabled = true; } return $enabled; }
/** * 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; }
/** * 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; }
/** * Test if video can be set * * @test * @return void */ public function multimediaCanBeSet() { $multimedia = 'http://youtube.com/123'; $this->mediaDomainModelInstance->setMultimedia($multimedia); $this->assertEquals($multimedia, $this->mediaDomainModelInstance->getMultimedia()); }