Пример #1
0
 /**
  * returns the video player code, if the input is URL
  *
  * @param int $width width of video player
  * @param int $height height of video playe
  * @param int $autoPlay autocomplete option
  * @return HTML player code
  */
 public function getFeed($width = 640, $height = 385, $autoPlay = 0)
 {
     $get_url_feed = new IzapVideos();
     $feed = $get_url_feed->input($this->input_object, 'url');
     $get_url_feed->videosrc = $feed->videoSrc;
     $get_url_feed->converted = 'yes';
     $player = $get_url_feed->getPlayer($width, $height, $autoPlay);
     return $player;
 }
Пример #2
0
 /**
  * returns the video player code, if the input is URL
  *
  * @param int $width width of video player
  * @param int $height height of video playe
  * @param int $autoPlay autocomplete option
  * @return HTML player code
  */
 public function getFeed($width = 600, $height = 360, $autoPlay = 0)
 {
     $get_url_feed = new IzapVideos();
     $feed = $get_url_feed->input($this->input_object, 'url');
     // in case there is an error
     if (!is_object($feed)) {
         return elgg_echo('izap_videos:error:code:' . $feed);
     }
     $get_url_feed->videotype = $feed->type;
     $get_url_feed->videosrc = $feed->videoSrc;
     $get_url_feed->converted = 'yes';
     $player = $get_url_feed->getPlayer($width, $height, $autoPlay);
     return $player;
 }
Пример #3
0
 /**
  * Create new video entity
  * 
  * @return ElggEntity VIDEOS
  * 
  * @version 5.0
  */
 public function createVideoEntity()
 {
     if (!filter_var($this->input, FILTER_VALIDATE_URL)) {
         $this->errors[] = 'Not valid url, currently supported for OFFSERVER videos only';
         return FALSE;
     }
     // try saving the entity now
     $izap_videos = new IzapVideos();
     $izap_videos->access_id = ACCESS_PUBLIC;
     $return = $izap_videos->input($this->input, 'url');
     if (isset($return->status) && $return->status === FALSE) {
         $this->errors[] = $return->message;
         return FALSE;
     }
     if ($return->videosrc == '' || $return->filecontent == '') {
         $this->errors[] = elgg_echo('izap_videos:error');
         return FALSE;
     }
     $izap_videos->title = $return->title;
     $izap_videos->description = $return->description;
     $izap_videos->tags = string_to_tag_array($return->videotags);
     $izap_videos->videosrc = $return->videosrc;
     $izap_videos->videotype = $return->type;
     $izap_videos->orignal_thumb = "izap_videos/" . $return->type . "/orignal_" . $return->filename;
     $izap_videos->imagesrc = "izap_videos/" . $return->type . "/" . $return->filename;
     $izap_videos->videotype_site = $return->domain;
     $izap_videos->converted = 'yes';
     $izap_videos->setFilename($izap_videos->orignal_thumb);
     $izap_videos->open("write");
     if ($izap_videos->write($return->filecontent)) {
         $thumb = get_resized_image_from_existing_file($izap_videos->getFilenameOnFilestore(), 120, 90, true);
         $izap_videos->setFilename($izap_videos->imagesrc);
         $izap_videos->open("write");
         if (!$izap_videos->write($thumb)) {
             $this->errors[] = elgg_echo('izap_videos:error:saving_thumb');
             return FALSE;
         }
     } else {
         $this->errors[] = elgg_echo('izap_videos:error:saving_thumb');
         return FALSE;
     }
     // if every thing is good till here now we can save it.
     if (!$izap_videos->save()) {
         $this->errors[] = register_error(elgg_echo('izap_videos:error:save'));
         return FALSE;
     }
     return $izap_videos;
 }