summaryrefslogtreecommitdiff
path: root/modules/gallery/views
diff options
context:
space:
mode:
authorshadlaws <shad@shadlaws.com>2012-12-30 10:03:36 +0100
committershadlaws <shad@shadlaws.com>2012-12-30 10:03:36 +0100
commit8300c867a1eb2a709aa0a0c019dfa47a670024dc (patch)
tree54d7d80615011246ed0cdf78ba471ca585b4329c /modules/gallery/views
parent7777baa156c2fbc65ca93b9533212ef22ed90105 (diff)
#1931, #1932, #1933, #1934 - movieplayer view and movie_img function in items model
Many changes to movieplayer view and movie_img function in items model: - include control bar height when dimensioning movie player - provide a default "guess" at height and width when they are set as zero in items table - resize movie player once the video is loaded based on its actual metadata - add get_movie_img event to provide flexibility for altering/replacing the default Flowplayer v3 --HG-- extra : rebase_source : 5d1e9bb66ebf3e3fed5e1b9ee63790a204f21450
Diffstat (limited to 'modules/gallery/views')
-rw-r--r--modules/gallery/views/movieplayer.html.php61
1 files changed, 42 insertions, 19 deletions
diff --git a/modules/gallery/views/movieplayer.html.php b/modules/gallery/views/movieplayer.html.php
index 343eafe8..25cb9f58 100644
--- a/modules/gallery/views/movieplayer.html.php
+++ b/modules/gallery/views/movieplayer.html.php
@@ -1,26 +1,49 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
-<?= html::anchor($item->file_url(true), "", $attrs) ?>
+<?= html::anchor($url, "", $attrs) ?>
<script type="text/javascript">
- flowplayer(
- "<?= $attrs["id"] ?>",
- {
- src: "<?= url::abs_file("lib/flowplayer.swf") ?>",
- wmode: "transparent",
- provider: "pseudostreaming"
- },
- {
- clip: {
- scaling: 'fit'
- },
- plugins: {
- pseudostreaming: {
- url: "<?= url::abs_file("lib/flowplayer.pseudostreaming-byterange.swf") ?>"
+ var id = "<?= $attrs["id"] ?>";
+ var max_size = <?= $max_size ?>;
+ // set the size of the movie html anchor, taking into account max_size and height of control bar
+ function set_movie_size(width, height) {
+ if((width > max_size) || (height > max_size)) {
+ if (width > height) {
+ height = Math.ceil(height * max_size / width);
+ width = max_size;
+ } else {
+ width = Math.ceil(width * max_size / height);
+ height = max_size;
+ }
+ }
+ height += flowplayer(id).getConfig().plugins.controls.height;
+ $("#" + id).css({width: width, height: height});
+ };
+ // setup flowplayer
+ flowplayer(id,
+ $.extend(true, {
+ "src": "<?= url::abs_file("lib/flowplayer.swf") ?>",
+ "wmode": "transparent",
+ "provider": "pseudostreaming"
+ }, <?= json_encode($fp_params) ?>),
+ $.extend(true, {
+ "plugins": {
+ "pseudostreaming": {
+ "url": "<?= url::abs_file("lib/flowplayer.pseudostreaming-byterange.swf") ?>"
},
- controls: {
- autoHide: 'always',
- hideDelay: 2000
+ "controls": {
+ "autoHide": "always",
+ "hideDelay": 2000,
+ "height": 24
+ }
+ },
+ "clip": {
+ "scaling": "fit",
+ "onMetaData": function(clip) {
+ // set movie size a second time using actual size from metadata
+ set_movie_size(parseInt(clip.metaData.width), parseInt(clip.metaData.height));
}
}
- }
+ }, <?= json_encode($fp_config) ?>)
).ipad();
+ // set movie size using width and height passed from movie_img function
+ $("document").ready(set_movie_size(<?= $width ?>, <?= $height ?>));
</script>