Example #1
0
 /**
  * Initialize the video
  */
 private function _initVideo()
 {
     $videoType = StreamVideo::getType($this->source);
     $video = StreamVideo::getVideo($videoType);
     if ($video->init($this->source)) {
         $this->title = $video->getTitle();
         $this->description = $video->getDescription();
         $this->duration = $video->getDuration();
         $this->type = $video->getType();
         $this->thumb = $video->getThumbnail();
         $this->video_id = $video->getId();
     }
 }
Example #2
0
 /**
  *
  */
 public function load($keys = null, $reset = true)
 {
     if (!is_array($keys)) {
         // Load by primary key.
         $keys = array($this->_tbl_key => $keys);
     } else {
         // Return false for videos link
         StreamFactory::load('libraries.video');
         $videoLib = new StreamVideo();
         $videos = $videoLib->getURL($keys['link']);
         if (in_array($keys['link'], $videos)) {
             return false;
         }
         // Return false for slidehshare links
         StreamFactory::load('libraries.slideshare');
         $ssLib = new StreamSlideshare();
         $slideShares = $ssLib->getURL($keys['link']);
         if (in_array($keys['link'], $slideShares)) {
             return false;
         }
     }
     $result = parent::load($keys, $reset);
     $this->_params = new JParameter($this->params);
     if (!$result && isset($keys['link'])) {
         $this->link = $keys['link'];
     }
     if (empty($this->params)) {
         $this->params = StreamLinks::grab($this->link);
         if ($this->params) {
             $date = new JDate();
             $this->timestamp = $date->format('Y-m-d h:i:s');
             $this->store(true);
         }
     }
     return $result;
 }
Example #3
0
 /**
  * If there are videos, store it
  */
 private function _filterVideoURL(&$stream)
 {
     StreamFactory::load('libraries.video');
     $rawData = json_decode($stream->raw);
     $videoLib = new StreamVideo();
     $videos = $videoLib->getURL($stream->message);
     $rawData->video = array();
     //print_r($videos); exit;
     if ($videos) {
         // Youtube link found
         foreach ($videos as $youtubeLink) {
             $video = JTable::getInstance('Video', 'StreamTable');
             $video->load(array('source' => $youtubeLink));
             $video->store();
             $rawData->video[] = $video->id;
         }
     }
     $stream->raw = json_encode($rawData);
 }