public function __toString()
{
global $Campsite;
$translator = \Zend_Registry::get('container')->getService('translator');
ob_start();
echo '<div class="mediaplayer ', str_replace('/', ' ', $this->type), '">';
// present by content type
switch ($this->type) {
case 'image/jpeg':
case 'image/png':
case 'image/gif':
echo '<img src="', $this->src, '" height="240" alt="', $this->alt, '" />';
break;
case 'audio/mpeg':
case 'audio/ogg':
case 'audio/mp3':
case 'audio/mp4':
case 'application/ogg':
echo '<audio src="', $this->src, '" controls="controls">';
echo '</audio>';
break;
case 'video/mp4':
case 'video/ogg':
case 'video/webm':
// html5 + flow player fallback
include dirname(__FILE__) . '/video.phtml';
break;
case 'video/flv':
case 'video/x-flv':
$player = $Campsite['WEBSITE_URL'] . '/public/videos/player.swf';
include dirname(__FILE__) . '/flash.phtml';
break;
}
// download link
echo '<p><strong>', $translator->trans('Download file', array(), 'library'), ':</strong> ';
echo '<a href="', $this->src, '">', $this->alt, '</a></p>';
echo '</div>';
if (!self::$playerLoaded) {
//include_once dirname(__FILE__) . '/player.phtml';
self::$playerLoaded = TRUE;
}
return ob_get_clean();
}