示例#1
0
文件: File.php 项目: mastito03/Embed
 /**
  * {@inheritdoc}
  */
 public function getCode()
 {
     if ($code = parent::getcode()) {
         return $code;
     }
     switch (self::$contentTypes[$this->request->getMimeType()][1]) {
         case 'videoHtml':
             return Utils::videoHtml($this->image, $this->url, $this->imageWidth, $this->imageHeight);
         case 'audioHtml':
             return Utils::audioHtml($this->url);
         case 'google':
             return Utils::google($this->url);
     }
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function getCode()
 {
     if ($this->bag->has('video')) {
         $video = $this->bag->get('video');
         if (!($videoPath = parse_url($video, PHP_URL_PATH)) || !($type = pathinfo($videoPath, PATHINFO_EXTENSION))) {
             $type = $this->bag->get('video:type');
         }
         switch ($type) {
             case 'swf':
             case 'application/x-shockwave-flash':
                 return Utils::flash($video, $this->getWidth(), $this->getHeight());
             case 'mp4':
             case 'ogg':
             case 'ogv':
             case 'webm':
             case 'application/mp4':
             case 'video/mp4':
             case 'video/ogg':
             case 'video/ogv':
             case 'video/webm':
                 $images = $this->getImagesUrls();
                 return Utils::videoHtml(current($images), $video, $this->getWidth(), $this->getHeight());
         }
     }
 }