Permalink
Browse files

Code video alternatives into the db.

Instead of mangling the DB with alternatives, provide the real
file with web-encoded alternatives as subfield for the real
file.

This way the .js code can offer the proper encoded versions
and it can still offer to download the real file through
the download link.

.js code will need to parse .alts[] from here.
  • Loading branch information...
sofar committed Oct 9, 2012
1 parent 6354dca commit d79ce205878e3acfdc4b4a806e166749d3ee5f6f
Showing with 21 additions and 3 deletions.
  1. +21 −3 db.php
View
24 db.php
@@ -104,9 +104,6 @@
continue;
}
- # now we just include the original video, let the .js code
- # handle getting the recoded video versions.
-
$a .= "{ name: '" . $image . "'";
# store original date of the file
@@ -127,6 +124,27 @@
$a .= ", date: " . $date . " ";
}
+ # for video types, include web-playable versions
+ switch (strtolower($pi['extension'])) {
+ case 'avi':
+ case 'mpg':
+ $a .= ', alts: [ "' .
+ $pi['filename'] . '.mp4", ' .
+ $pi['filename'] . '.ogv" ' .
+ '] ';
+ break;
+ case 'mp4':
+ $a .= ', alts: [ "' .
+ $pi['filename'] . '.ogv" ' .
+ '] ';
+ break;
+ case 'ogv':
+ $a .= ', alts: [ "' .
+ $pi['filename'] . '.mp4" ' .
+ '] ';
+ break;
+ }
+
$a .= "}";
# date tag the album based on the oldest item

0 comments on commit d79ce20

Please sign in to comment.