You are here

public function video_s3::load_file in Video 6.5

Same name and namespace in other branches
  1. 6.4 plugins/video_s3/filesystem/video_s3.inc \video_s3::load_file()

Process the given video in preparation for use on the front end.

Overrides video_filesystem::load_file

File

plugins/video_s3/filesystem/video_s3.inc, line 29
Class file used to store videos in Amazon S3.

Class

video_s3

Code

public function load_file(stdClass $video) {
  $s3 = $this->s3;
  if ($s3 != NULL && ($s3file = $s3
    ->get($video->fid))) {
    foreach ($video->files as $key => &$file) {
      $filepath = $file->filepath;

      // For old video's (pre-4.5), the filename property is actually a path
      // and no locally converted files were saved to S3.
      if (strpos('/', $file->filename) !== FALSE) {
        $filepath = $file->filename;
      }
      $file->url = $s3
        ->getVideoUrl($filepath, $s3file->bucket);
    }
  }
}