コード例 #1
0
 /**
  * @test
  */
 public function setAndGetCopyrightFromParentVideo()
 {
     $parentVideo = new Video();
     $parentVideo->setCopyright('Copyright from parent video');
     $this->subject->setParentid($parentVideo);
     self::assertSame('Copyright from parent video', $this->subject->getCopyright());
 }
コード例 #2
0
 /**
  * Render content of video tag.
  *
  * @param array $settings   The settings array
  * @param Video $video      The video object
  * @param bool  $responsive
  *
  * @return string
  */
 public function render(array $settings, Video $video, $responsive = false)
 {
     $this->tag->forceClosingTag(true);
     if (false === $responsive) {
         // The width and height cascade: settings, video, default
         $settingsVideoWidth = $settings['videoWidth'] ? $settings['videoWidth'] : $settings['video']['defaultWidth'];
         $settingsVideoHeight = $settings['videoHeight'] ? $settings['videoHeight'] : $settings['video']['defaultHeight'];
         $videoWidth = $video->getWidth() ? $video->getWidth() : $settingsVideoWidth;
         $videoHeight = $video->getHeight() ? $video->getHeight() : $settingsVideoHeight;
         if ($videoWidth > $videoHeight) {
             $videoRatio = $videoHeight / $videoWidth;
         } else {
             $videoRatio = $videoWidth / $videoHeight;
         }
         if ($settings['videoWidth'] > 0 && $settings['videoHeight'] > 0) {
             $videoWidth = $settingsVideoWidth;
             $videoHeight = $settingsVideoHeight;
         } elseif ($settings['videoWidth'] > 0) {
             $videoWidth = $settingsVideoWidth;
             $videoHeight = $videoWidth * $videoRatio;
         } elseif ($settings['videoHeight'] > 0) {
             $videoHeight = $settingsVideoHeight;
             $videoWidth = $videoHeight * $videoRatio;
         }
         $this->tag->addAttribute('width', floor($videoWidth));
         $this->tag->addAttribute('height', floor($videoHeight));
     }
     if ($video->getPosterImage()) {
         $this->tag->addAttribute('poster', $video->getPosterImage()->getOriginalResource()->getPublicUrl());
     }
     if ($settings['skin']) {
         $this->tag->addAttribute('class', $settings['skin']);
     }
     $this->tag->setContent($this->renderChildren());
     return $this->tag->render();
 }
コード例 #3
0
 /**
  * @return string
  */
 public function getDuration()
 {
     if ($this->duration) {
         return $this->duration;
     } elseif ($this->parentid instanceof self) {
         return $this->parentid->getDuration();
     }
     return $this->duration;
 }